You could harm the soil if you're not cautious. Epsom salt has long been considered a good choice to add to the soil for magnesium deficiency. Table salt used for cooking is sodium chloride.
Salts are natural components of soil, surface, and groundwater. They are ionic mineral compounds, which means they bonded by electrostatic attractions between cations (+ charge) and anions (- charge).