The ulcer-causing gastric pathogen Helicobacter pylori is the only bacterium known to colonize the harsh acidic environment of the human stomach. H. pylori survives in acidic conditions by producing urease, which catalyzes hydrolysis of urea to yield ammonia thus elevating the pH of its environment. However, the manner in which H. pylori is able to swim through the viscoelastic mucus gel that coats the stomach wall remains poorly understood. Previous rheology studies on gastric mucin, the key viscoelastic component of gastric mucus, indicate that the rheology of this material is pH dependent, transitioning from a viscous solution at neutral pH to a gel in acidic conditions. Bulk rheology measurements on porcine gastric mucin (PGM) show that pH elevation by H. pylori induces a dramatic decrease in viscoelastic moduli. Microscopy studies of the motility of H. pylori in gastric mucin at acidic and neutral pH in the absence of urea show that the bacteria swim freely at high pH, and are strongly constrained at low pH. By using two-photon fluorescence microscopy to image the bacterial motility in an initially low pH mucin gel with urea present we show that the gain of translational motility by bacteria is directly correlated with a rise in pH indicated by 2',7'-Bis-(2-Carboxyethyl)-5-(and-6)-carboxyfluorescein (BCECF), a pH sensitive fluorescent dye. This study indicates that the helicoidal-shaped H. pylori does not bore its way through the mucus gel like a screw through a cork as has previously been suggested, but instead achieves motility by altering the rheological properties of its environment.