Because it will be the only insoluble compound formed by that reaction. The other product of the reaction, sodium nitrate, is soluble in aquesous solution.
To see why that happens, you have to be familiar with the solubility rules
Here's what actually goes on when you mix those two solution.
Both barium nitrate and sodium sulfate are soluble, so they exist as cations and anions in solution
Notice however that compounds formed by the sulfate anion,
The other product of the reaction, sodium nitrate, is soluble, so it will exist as cations and anions in solution as well.
Hence, when the two solutions mix, you get
This is know as the complete ionic equation. If you eliminate spectator ions, i.e. ions that are present both on the reactants', and on the products' side, you'll get the net ionic equation, which looks like this
So, barium sulfate is the only precipitate that forms because the other product of the reaction is soluble, and thus exists as cations and anions in solution.
Barium sulfate is the only compound that precipitates because the other product is sodium nitrate, which is soluble.
The overall equation is:
All nitrates are soluble so the sodium and nitrate(V) ions remain in solution.
They take no part in the reaction so can be regarded as spectator ions.
The ionic equation is therefore: