Barium is a Group 2 element, hence in its ionic form, it donates one valence electron (total two) to each chloride ion (of Group 17), creating an ionic compound.
Barium forms Ba2+ and chloride means Cl−
To form neutral compound they combined in 1:2 ratio