For formation of a neutral ionic compound, the charges on cation and anion must be balanced. The cation is formed by loss of electrons by metals and anions are formed by gain of electrons by non metals.
If iron is having an oxidation state of +3 called as cation. Sulphur is an anion with oxidation state of -2 and forms sulphide ion . Thus they combine and their oxidation states are exchanged and written in simplest whole number ratios to give neutral .
The cations and anions being oppositely charged attract each other through strong coloumbic forces and form an ionic bond.