As Barium belongs to Group II elements (Alkaine Earth Metals), it has two valence electrons in 6 shell, Hence it capable of loosing two electrons and adopting +2 charge as,
Ba → Ba⁺² + 2 e⁻
And Chlorine belongs to Group VII elements (Halogens), it has seven valence electrons in 3rd shell, Hence it is capable of accepting one electron and adopting -1 charge as,
Cl + e⁻ → Cl⁻
Now, for the formation of Barium Chloride we need 2 chloride ions and one Barium cation, as two -1 and one +2 charge can add to form a neutral molecule. Hence,
Ba⁺² + 2 Cl⁻ → BaCl₂