Some people say its there to cover either a missing eye or an eye that was wounded in battle, but in actual fact it is conditioning their eye so they can fight in the dark. think about it, it takes an average human eye about 5-6 minutes to change to so called 'night vision', so if i pirate was fighting on deck in well lit light, then had to go under the deck to fight downstairs where it is usually pretty dark, 5-6 minutes is a long time to be swinging a blind sword when people are trying to kill you, so smart pirates would use an eye patch to prepare that eye to see in the dark, so when they would jump down into the dark, they would swap over the eye patch from one eye to the other and see with the eye that has already adjusted to low light conditions, therefore, granting them to see instantly in the dark.