Beiersdorf has agreed to buy Bayer's Coppertone brand of sun-care products, bolstering its line of skin creams that already includes the Nivea brand.