Magnesium hydroxide provides relief for indigestion by reacting with HCl to produce a solution that is neutral.
Magnesium hydroxide in the stomach acts as an antacid (i.e substance that neutralizes stomach acidity). They are utilized as laxatives for the sole purpose of treating constipation and increasing bowel movements.
When present in the stomach, magnesium hydroxide reacts with the HCl produced by the parietal cells that are present in the gastric glands to neutralize these acids and produce a solution that is neutral.