Science has finally explained the purpose of beer foam. According to Fusion, fluid physicists from Princeton and the École Normale Superieure de Cachan in France, finally figured out why beer "sloshes around" less than water. Through experiments requiring high-speed cameras, water, and glycerol researchers found that the foam on a beer acts "as a stopper."
When a bartender hands a customer a pint, the movement creates tiny waves in the drink. When those waves become too big, the beer spills over. The frothy foam "helps to dampen those waves," however. By latching on to the edge of the glass, the foam makes those waves "shorter" in height.
This idea also applies to other foam-topped drinks like lattes, which scientists say also spill less than water or even plain black coffee. While foam reduces beer spillage, it can't combat all the effects of drunkenness — like attempting to pay for your tab with a rock. Only sobriety can do that.