Two words: Le Chatelier's Principle.
Magnesium hydroxide has a solubility product constant,
This means that when solid magnesium hydroxide is added to water, an equilibrium reaction will be established
#"Mg"("OH")_text(2(s]) rightleftharpoons "Mg"_text((aq])^(2+) + 2"OH"_text((aq])^(-)#
As you know, all chemical equilibrium reactions are governed by Le Chatelier's Principle, which states that a dynamic equilibrium will respond to any change in the conditions of the reaction by favoring the reaction that counteracts those chanhes.
Any chemical equilibrium consists of the forward reaction, which consumes the reactants and forms products, and the reverse reaction, which consumes the products and reforms the reactants.
Looking at the above equilibrium, what would determine the solid to dissolve more?
Well, if you decrease the cocnentration of hydroxide ions, the equilibrium will try to counteract this change by producing more hydroxide ions.
How does it do that? It favors the forward reaction, which leads to more of the solid being consumed, i.e. dissolved.
This is where the ammonium chloride comes into play. Being a soluble salt, it dissociates completely to form ammonium cations and chloride anions
#"NH"_4"Cl"_text((aq]) -> "NH"_text(4(aq])^(+) + "Cl"_text((aq])^(-)#
The ammonium ions can act as an acid and neutralize the hydroxide ions. The reaction will form ammonia and water
#"NH"_text(4(aq])^(+) + "OH"_text((aq])^(-) -> "NH"_text(3(aq]) + "H"_2"O"_text((l])#
So, to sum this up, this is what happens
- the ammonium cations will neutralize the hydroxide anions present in the solution
- as a response, the equilibrium will shift to the right to create more hydroxide anions
- in turn, this will determine more ions to be dissolved from the solid