The indigenous Carribeans in the 18th century used a mixtured of roucou dye and castor oil, which a French observer wrote made them "look like boiled lobsters". The mixture was both decorative and protective. (source Native Diasporas: Indigenous Identities and Settler Colonialism in the Americas) Castor oil alone is a decent protection against sunburn. It absorbs UV light rather well. I couldn't find much mention of these solutions in 19th century literature, which is odd because lots of white people were living in the sunny parts of the world by then, so sunburn had to be a frequent topic of discussion. In India, a traditional remedy for burns was "chicken oil", which has fantastic UV absorption, but I found no mention of white people using it (and Indian people are adapted to their sunny climate). It might be because of the smell. It smells like chicken. You don't want that stuff getting in your clothes, going rancid, etc. The Indians used it to treat burns, because when you're hurting from a burn you don't care so much about smelling nice.
Clothing was another option, but amusingly some writers thought that the wrong kind of clothing made sunburn worse. Eg, in 1852, William Kid wrote that "white veils have a tendency to increase sunburn and freckles, by their increasing -- as they do -- the intensity of the sun's light (source: Kidd's Own Journal vol 2). In that same book, Kidd proposed a silly homemade preventative that I'm sure is quite useless: a "preventative wash" of borax, alum, camphor, sugar-candy, and ox-gall.
An 1881 edition of Arthur's Home Magazine advised no washing immediately before going out.
Cold cream is recommend for ladies in The Woman's Book: Dealing Practically with the Modern Conditions of Home-life, Self-support, Education, Opportunties, and Every-day Problems, Volume 2 (1894).
A doctor wrote in 1883 that "Medical treatment for prevention may not be abundantly satisfactory, but a most efficient and speedy remedy for sunburn is a free application of alcohol to the affected part." This suggests that people in the 19th century had little clue on how to properly prevent sunburn from exposure. It was either cover up, stay indoors, or have a remedy on hand (Source: Forest and Stream vol 20 (1883)).
They used the sort of ochre and butter fats you see the himba (an African tribe) wearing,there are many natural sunscreens made of carrot oil etc.