As the other educators have noted, the purpose of putting coins over the eyes of the dead was to pay passage across the Styx River. The very first reference to this practice comes from the work of Aristophanes, who was a writer of Greek comedies. In his play, The Frogs, he talks about putting a coin in the mouth of a dead person to pay the boatman. It is worth noting that placing a coin inside the mouth of a dead person seems to have been more common than placing it over the eyes.
If you look at the reference link provided, you will see an example of a coin used for this purpose. Note that the coin was small and was of low value, suggesting that the passage across the river was not expensive. This is worth noting because it means that less wealthy families were able to pay the fare for their loved ones and not leave them wandering around in the afterlife.
According to Greek mythology, when people died their souls moved to the underworld, also known as Hades. Hades had five rivers, one of which was named Styx, and dead souls had to cross it after departing the world of the living. The only way to do this was through a boat operated by Charon, an underworld spirit who served king Haides. Charon’s charge for this service was a single obolos (silver coin) which the Greek placed in the mouth of the deceased or on their eyes during burial. In the event that a deceased was not accorded due burial and so lacked the coin for Charon’s service, their soul was left wandering the river shore while tormenting the living on earth as ghosts. The coin was therefore placed in the mouth or on the eyes but for the same purpose; to pay Charon for transporting the dead souls to Hades.
In Greek mythology, the recently deceased would be sent down to Hades, or the underworld. In order to pass over the rivers Acheron and Styx, you would have to pay the toll- a coin, left in the mouth of your dead body. Most primary sources about Hades mention specifically putting the coin in or near the mouth, although it seems that putting two gold coins (one over each eye) was also a method used occasionally. If the dead were not buried with a coin in the mouth or on the eyes, he or she would be doomed to wander around in the entrance to Hades, before the rivers which served as a boundary. Essentially, he or she would be in what the Christians call "limbo".
The greeks placed coins, usually coins called either an "obulus" or a "danake" to pay Charon, the boatman who would ferry the dead across the river Styx. Without payment, there was a danger that the departed soul would be forced to stay on the shore of Hades for an undetermined length of time.