NH4Cl is strong electrolyte, it decomposes completely while the NH4OH is weak base it does not ionises completely. Thus due to presence of common ion \(NH_4^+\) in NH4Cl it supresses the ionisation of weak NH4OH in order to decrease the OH- concentration so that higher group cations will not get precipitated.
NH4Cl → NH4 + Cl-
NH4OH ↔ NH4 + OH-
Mg will not be precipitated after addition of (NH4)2 CO3.