Some people may develop a rash when lotions or sunscreens with ingredients to which they are sensitive are applied to skin, then exposed to sun. Certain medications may make a person more sensitive to sun exposure, leading to a rash.
A common reason for a rash at the beach is "sea bather's itch". This is caused by exposure to the larval form of tiny jellyfish or other larvae too small to see. The rash usually occurs under the bathing suit, where the tiny organisms are trapped next to the skin. There may be a prickly sensation while in the water, but the rash usually develops a couple of hours to a couple of days after swimming. The rash is caused by the body's allergic reaction to toxin from the organisms.
There is little you can do to avoid such tiny creatures if you swim in the ocean and the waters are infested with them at the time. People react differently. Some may develop the rash in areas where the larvae are present, others may not. If you develop sea bather's itch, remove your bathing suit as soon as possible and shower. If you are itchy, over-the-counter cortisone cream can be applied to the rash, and oral (by mouth) antihistamines can be helpful.
Be sure to see a doctor if the problem does not improve or if you feel ill or develop other symptoms. If so, your doctor may need to give you prescription cortisone to take orally for relief.