Stomach acid, primarily composed of hydrochloric acid, plays a critical role in digestion by breaking down food and activating digestive enzymes. It also serves as a defense mechanism against pathogens ingested with food, maintaining gut health and preventing infections.