This has been asked on r/AskHistorians several times:
How did people deal with sunburn during medieval times
How did people cope with sunburn before the time of sunscreen
Did Pirates get terrible sunburn & skin cancer due to overexposure
How did Roman Soldiers deal with sunburn?
How did people back in the middle ages fight sunburn?