Sunscreen protects the skin from harmful UV rays, which can cause skin damage, premature ageing, and increase the risk of skin cancer.