Magnesium is an element that the body needs to fulfill its normal functions. Magnesium oxide can be used as an antacid to relieve stomach upset caused by heat or heartburn (heartburn), as a laxative for brief periods to achieve rapid bowel emptying (eg prior to surgery). This medication should not be used repeatedly. Magnesium oxide is also used as a dietary supplement when the amount of magnesium present in the diet is not sufficient.