Sea foam, also referred to as ocean foam, beach foam, or spume is a type of foam created by the agitation of seawater, particularly when it contains higher concentrations of dissolved organic matter (proteins, fats, dead algae). These substances can act as surfactants or foaming agents. As the seawater is churned by breaking waves in the surf zone adjacent to the shore, the presence of these surfactants under turbulent conditions traps air, forming persistent bubbles which stick to each other through surface tension. Due to its low density and persistence, under some circumstances foam can be blown by strong on-shore winds from nearshore waters onto the beach itself and adjacent land.
This post at Deep Sea News has some great video clips of sea foam in Australia and on the U.S. East Coast.
Algal blooms are one common source of thick sea foams. When large blooms of algae decay offshore, great amounts of decaying algal matter often wash ashore. Foam forms as this organic matter is churned up by the surf.
Most sea foam is not harmful to humans and is often an indication of a productive ocean ecosystem. However, when large harmful algal blooms decay near shore, there is potential for impacts to human health and the environment. Along Gulf coast beaches during blooms of Karenia brevis, for example, popping sea foam bubbles are one way that algal toxins become airborne. The resulting aerosol can irritate the eyes of beach goers and poses a health risk for those with asthma or other respiratory conditions. Scientists studying the cause of a seabird die-offs off California in 2007 and in the Pacific Northwest in 2009 also found a soap-like foam from a decaying Akashiwo sanguinea algae bloom had removed the waterproofing on feathers, making it harder for birds to fly. This led to the onset of fatal hypothermia in many birds.
What is Sea Foam?, National Ocean Service, NOAA
FYI: What Is Sea Foam? Where Does It Come From?, Popular Science