The metal hydroxides are present in salts and they react with HCl present in the stomach to produce salt, water and a gas.
The salts that are produced after the reaction are soluble in water.
CaCO3 + HCl → CaCl2 + CO2 + H2O
​Calcium carbonate is a common component of antacids and is insoluble but calcium chloride is soluble.