Magnesium hydroxide relieves pain by neutralizing the acid in your stomach. It also creates more water in your intestines. These activities should help you have a bowel movement if you are constipated. They should also relieve any pain associated with heartburn and indigestion. Magnesium hydroxide should be used to treat symptoms on a short-term basis only. Consult a doctor if your condition persists.