The subscript 2 indicate that there are two atoms of chlorine in the compound.
Explanation
Subscript in the chemical formula indicate the number of atoms of the element immediately before the subscript.
In MgCl₂ there are two(2) atoms of chlorine since Subscript 2 is immediately after chlorine.