Salt is used in aquaculture for food fish because it is safe and treats most diseases that affect freshwater fish.
My understanding is the bacteria, fungus and protozoans can't tolerate the salt water and when it goes above a certain level, they die off. The fish can tolerate higher levels of salt and don't die.
How it works, I don't know. One of the members here mentioned it might be the sodium and chloride separating in the water to produce low levels of chlorine in the water that kills the disease organisms. But I don't know. I simply use it because it works most of the time and is safer than anything sold in shops.