The men and women in my field of study (the 18th/19th c Royal Navy) would generally attempt to protect themselves from sunburn by avoiding exposure to the sun. Sailors in northern Europe don't always have to protect themselves from heavy sun exposure, of course, but as the RN expanded into tropical waters (the Caribbean, India, etc) sunburn and sunsickness became a larger concern.
Sailors' working clothes aboard ship traditionally would include loose pants, long-sleeved shirts and broad-brimmed hats. I wrote more about sailors' clothes in this thread -- while there are a lot of images in that, this one in particular, while sketchy on the battle details, gives you an idea of the diversity of outfits sailors would wear to work in.
In tropical climates, most captains would rig awnings for shade, and sailors would stay out of the sun under them whenever possible. When they inevitably did get sunburned, they could use a salve of some kind of grease (often "slush" from cooking kettles) to help with the pain/blistering. Many sailors no doubt just had enough sun exposure to become deeply tanned, in the manner of sailors today, on whatever skin they had exposed to the sun.