It was a tradition dating back to greek times, in those days they believed that when you died you had to pay the ferry man on the river styx to cross, if you didn't have two bits of gold you were doomed to never enter the afterlife. when someone died on land gold coins were placed on their eyes before the funeral pyre was lit, but sailors at sea ran the risk of the boat sinking or falling off and drowning, so there would be no way for two coins to be placed with them after death. eventually someone got the idea to wear two gold earrings, so that they could use that gold to pay the ferry man. even tho that religious belief no longer continues sailors tend to be the most superstitious of any profession, as their lives are always at risk. breaking tradition is just asking for bad luck to come looking for you, so still sailors get earrings because its tradition.