While the life of a sailor was one highly likely to lead to the loss of eyes and limbs and many pirates used eye patches for the obvious eye-patching use; Paul Derreck suggests that they may also have been used to help acclimate the eye to darkness below deck.
The below-decks of sailing ships were very dark while the above decks were blindingly bright in contrast:
After being below for a while their eyes would adapt tot he low-light and they could see. But if they were to briefly go topside, the bright light would ruin their dark-adapted eyes, making it difficult to see when they went back below.
So, as the story goes, when going topside they covered one eye with a patch so that eye would still be dark adapted when they went back down.