Magnesium Oxide is used to treat patients with magnesium deficiency. It is also used to treat acid indigestion and upset stomach. Magnesium Oxide replaces the magnesium in the bloodstream to help the body function properly. This medication is available as an over the counter drug and as a prescription.