Why are the reagents used to test for cations?
Herein, why is BaCl2 used to test for sulphate ions?
BaCl2 solution acidified with hydrochloric acid is used as a reagent to test for sulphate ions. If acidified Barium Chloride is added to a solution that contains sulphate ions a white precipitate of Barium Sulphate forms. The Barium absorbs the x-rays and so the gut shows up on the x-ray image.
Similarly, you may ask, why is sodium hydroxide used to test cations?
For transition metals, a ligand exchange reaction is needed in order to properly test and identify cations. When sodium hydroxide is used to test cations, it engages and reacts with metal aquo complex.
The nitric acid is added first to remove any carbonate ions that might be present - they would produce a white precipitate of silver carbonate, giving a false positive result for chloride ions.