Milk of magnesia is used in antacids because it consists of magnesium hydroxide that neutralises the excess hydrochloric acid present in the stomach, thus reducing acidity. The presence of hydrochloric acid in excessive amounts in the stomach causes acidity, which damages the inner walls of the stomach causing painful wounds. Hence, antacids are used to treat acidity.