Cavities are caused by acid. The most common source of destructive acid is bacteria in the mouth. The bacteria metabolize sugar and produce acid as a byproduct. This is why sugar exposure and high bacterial loads put people at high risk for cavities.
How Saliva Protects Your Teeth
Saliva contains buffering compounds that counteract the acid and help the pH of the mouth remain neutral. Without saliva, the pH stays acidic for much longer periods of time, and the longer the teeth are exposed to acid, the more likely they are to develop cavities.