Magnesium Oxide can be used for a variety of purposes. Some people take it as an antacid to treat heartburn, indigestion, or sour stomach. This chemical can also be used as a laxative for quick, short-term stool emptying. It should not be used as per the advice of the physician. Magnesium Oxide aids in the relaxation of the body. This nutrient helps you sleep better and longer by reducing stress. Magnesium and melatonin can both be used to treat insomnia, and they can even be used together.