Rain Is Not Actually Fresh
Rain starts out nearly pure, but as it falls and soaks into the ground it absorbs carbon dioxide and becomes very weakly acidic (carbonic acid). That mild acid is powerful enough over time to dissolve the minerals in rock. Rainwater trickling through soil and bedrock leaches out ions — sodium, calcium, potassium, bicarbonate, chloride and sulfate among them — and every river on Earth quietly carries a faint load of these dissolved minerals downhill and toward the sea. The salt in the ocean is, overwhelmingly, the ash of continents washed away grain by grain.
The Ocean Keeps What the Rivers Bring
Here is the key point: when seawater evaporates to form clouds and rain, the water rises but the salt stays behind — evaporation separates pure water from dissolved solids, which is why sea salt is harvested by evaporating seawater in ponds. Over billions of years, the rivers kept delivering a trickle of ions and evaporation kept removing only the water, so the dissolved salts accumulated and concentrated. That is why the sea is salty while the rain that feeds it is not. The dominant ions are sodium (Na⁺) and chloride (Cl⁻) — ordinary table salt — and together they make seawater about 3.5% salt, roughly 35 grams in every litre.
A Second, Deeper Source
Rivers are not the whole story. At mid-ocean ridges, where hot magma meets cold seawater, hydrothermal vents pump superheated, mineral-rich fluid out of the crust and pull seawater down into it, chemically reacting with the rock. This exchange between water and the Earth's crust is a major supplier of chloride and other ions, and it helps explain why the ocean's composition is so uniform from one basin to another. Rainfall and evaporation follow the same logic everywhere in the water cycle.
Is the Sea Getting Saltier?
Surprisingly, the answer is: not really. The ocean's saltiness has been broadly steady for hundreds of millions of years, because the same processes that add salt also remove it. Salt is taken back out through aerosols sprayed into the air by breaking waves, through minerals precipitating into seafloor sediment, through reaction with rock at vents, and where shallow seas evaporate completely and leave behind thick salt deposits (the rock-salt you mine came from ancient dried-up seas). There are places that are saltier than average (the Red Sea, hot and closed with little inflow) and fresher than average (the Baltic, or the sea near a great river mouth), but the global average is held in a slow equilibrium — the ocean, like the rivers and deltas that feed it, is a system still being built and drained at the same time.
Freshwater Isn't Salt-Free Either
A final nuance: lakes with no outlet — ones that only lose water to evaporation — also accumulate salt and can turn into salty or desert-like brine lakes, for exactly the reason the ocean did. The Dead Sea and the Great Salt Lake are the same experiment run on a smaller, faster scale. And even "fresh" river and groundwater always carry some dissolved minerals; the difference is only degree and time.