The correct formula unit for the ionic compound magnesium chloride is MgCl2.
In magnesium chloride, magnesium (Mg) has a +2 charge, and each chloride (Cl) has a -1 charge. Therefore, to balance the charges, two chloride ions are needed for each magnesium ion, resulting in the formula MgCl2.