Oxygen is obtained from breathing it in. Your body compensates for the lack of oxygen during strenuous exercise by doing lactic acid fermentation, using the pyruvate and NADH generated in glycolysis to regenerate NAD+ (and make lactate) so that you can keep regenerating ATP.
You need ATP for muscular activity and without oxygen (or with very little) you cannot generate much ATP via aerobic metabolism. Glucose breakdown accelerates via this pathway. Your pH changes slightly (your body generally is at a neutral pH), but is restored soon after oxygen is inhaled and aerobic metabolism can proceed forward.
The lactate can be converted back to pyruvate and then metabolized via aerobic metabolism or can be used to synthesize glucose vie gluconeogenesis, if needed.