An excerpt from a piece on the 'stepping' of mast for the USS Carl Vinson:

As Carter explained, the ceremonial placing of coins at the base of a ship’s mast is a practice that goes back to at least the ancient Romans. It was thought to bring good luck to a ship and her crew, and the Navy adopted the ceremony as part of its traditional shipbuilding practice.


A semi-similar source talks about the stepping of the mast of the USS San Antonio thusly:

The ancient custom of “stepping the mast,” by placing coins under the step or bottom of a ship’s mast during construction, dates from antiquity. One belief from Greek Mythology is that should the ship be wrecked during passage, the coins would ensure payment of the crew’s wages for their return home. Since at least the construction of USS Constitution, this tradition has been passed on as a symbol of good luck for U.S. Navy ships.


And, wonder of wonders, for once there seems to be online confirmation of the practice at least hailing back to the Romans:

N. Carlson, "Mast-Step Coins Among the Romans" IJNA 2007

Interesting stuff ... personally, I'd suspect mast step coins have to do with providing those lost at sea with some possible way to pay the 'gate' to the underworld ...