I think it is because sodium preserves food, or is it just to add flavor?
Via the blog
You are partially correct.
Salt (which isn’t the same as sodium; table salt is a combination of sodium and chloride) and sugar were, really, the first two preservatives.
Before the age of refrigeration, meats were protected from spoiling with the help of generous layers of salt, and fruits were similarly drowned in sugar (thus the concept of jams).
The high sodium content in processed foods these days, though, isn’t solely to retard spoilage.
Issues of flavor, texture, and mouthfeel come into play.
In baked goods, for instance, sodium emphasizes sweet flavors.
Additionally, it sucks out moisture, thereby adding crunchy textures to crackers and chips.
Sodium is also used as a binder and thickener in products like gravies and sauces.
You’ll also find that many fortified products — think protein bars and some cereals — are fairly high in sodium, as it — along with sugar — helps mask the off-putting flavors of all those synthetic vitamins and minerals that are tacked on during processing.
From a production standpoint, sodium is wonderful — it’s inexpensive and universally accepted!
From a public health perspective, however, it certainly appears to be the next trans fat…