Urinary Tract Infections (UTIs): Infections in the urinary tract can sometimes cause the urine to foam due to the presence of bacteria, white blood cells, or other substances.
Presence of Certain Chemicals: Some chemicals in toilet water, such as soap or cleaning agents, can react with urine to create foam.