Magnesium is an element your body needs to function normally. Magnesium oxide may be used for different reasons. Some people use it as an antacid to relieve heartburn, sour stomach, or acid indigestion. Magnesium oxide also may be used as a laxative for short-term, rapid emptying of the bowel (before surgery, for example). It should not be used repeatedly. Magnesium oxide also is used as a dietary supplement when the amount of magnesium in the diet is not enough. Magnesium oxide is available without a prescription.