The correct formula unit for the ionic compound magnesium sulfide is MgS.
In magnesium sulfide, magnesium (Mg) has a +2 charge and sulfur (S) has a -2 charge. Therefore, one magnesium ion pairs with one sulfide ion to balance the charges, resulting in the formula MgS.