Cast your mind back say 3.5 billion years, give or take, when the world was just forming into a huge molten rock. In those days, Earth's early atmosphere contained a lot of hydrogen and probably quite a lot of water vapour too, as oxygen and hydrogen bond readily to form water. But, as the earth was a giant volcanic molten mess at the time, the surface and atmosphere were far too hot for liquid water. As you may know, boiling points are subject to conditions such as pressure (that's why rapid boiling tubes use a high pressure, like in a coffee machine) but also the composition of the atmosphere, which was losing hydrogen through the power of the Sun. The sun's energy can split water into oxygen and hydrogen, which then can escape earth's atmosphere and the relative amount of oxygen compared to water increased. I don’t quite understand why (probably something to do with pressure) but apparently this caused the temperature at which water remains a liquid to increase
As the boiling point of water rose until it hit the 100 degrees Celsius it sits at today, the temperature of the atmosphere gradually fell as the earth cooled. Eventually the temperature of the atmosphere dropped below the boiling point of water, and you have rain. Lots and lots of rain.
While the atmosphere may have been cool enough for liquid water, the surface certainly wasn't. As the train fell and was immediately turned back to vapour it slightly cooled the rocks, and as it turned back to liquid high up in the atmosphere the heat it had gained was eventually lost to space. This cycle could have easily continued for a million years until eventually most of the water on earth was liquid. The water then pooled in the lowest lying regions in the earth's surface to form the oceans.
So how did the sea get so full of salts and other minerals?
There would have been (and still is) a lot of dissolved carbon dioxide dissolved in the early oceans, which is acidic. Other acids like hydrochloric and sulphuric acid may also have been around too. These acids ate away at the earth's rocky surface, gradually adding salts and minerals like common salt and calcium. When life came about, these minerals were put to use. Calcium carbonate salts are used for producing hard shells and coral reefs and sodium chloride salt was used to form the very first nervous system (or possibly potassium chloride, they're is some debate). Even now, in all animals, salt is vital for the functioning of nervous systems and a lot of energy goes into maintaining the perfect balance of sodium and chloride ions dissolved in various cellular and extracellular fluids for optimal performance of the nervous system.
So now we have seas and we have salt, now all that's left is how the salt stays dissolved in the sea when the water evaporates. In essence, salt transitions to a gas at a much higher temperature than water, so water can evaporate at the sea's surface when warmed by energy from the Sun much more easily than salt, which is left behind.
To go a little deeper, common salt molecules are made up of one sodium atom (Na) and chlorine atom (Cl) to make sodium chloride (NaCl) – the salts in the sea are much more varied than that, but for simplicity let's just talk about common old table salt. The two atoms are normally bonded together by ionic bonds; because an Na ion has a positive charge (Na+) and a Cl ion has a negative charge (Cl-) . For salt to dissolve in water, water has to interact with salt molecules more strongly than salt interacts with other salt molecules. As the interactions between different salt molecules is weaker than their interactions with the many many more water molecules in the sea, salt dissolves and dissociates into its component ions (Na+ and Cl-) so that the Na sits on the slightly negative oxygen side of a water molecule and Cl sits on the slightly positive hydrogen side and the ions from the salts become mixed between the water molecules.
As you can see in this image, it is not just one water molecule required to dissolve one molecule of NaCl, but many. Apparently the minimum number of water molecules required to dissolve NaCl is between 9 and 6 for one salt molecule. If you want to get a little more complex you can start to talk about free energy. Essentially, the balance of energy used up by breaking the ionic bonds in the salt crystals and the energy released by forming new polar bonds with water works out in favour of dissolving the salt crystals - and so they dissolve.
Why does salt remain in the sea when water evaporates?
When the sea is heated by the sun, the water molecules gain energy and are able to turn into vapour (called a phase transition) much more easily than salt ions and therefore water evaporates and salts don’t in those conditions.
When the evaporated water eventually cools and rains on land somewhere, it eventually makes its way back to the sea and picks up lots of sediment full of salt and other minerals. Some of this sediment makes its way to the sea and can be used up by all sorts of sea creatures to form their shells or just fall to the sea bed and eventually form sedimentary rock as it gets compressed over many thousands of years.
If you boiled away all the water, you would eventually find that the salt began to reform salt crystals. This is because, as there is less and less water, it has now become more energetically favourable for the component ions to start reforming salts and to form a precipitate; the equilibrium of dissolved–precipitated salts shifts towards the solid precipitated salts. This is sort of what is happening in the Dead Sea, which has an incredibly high salinity, but it's more likely that a load of salts have been deposited there and they’ve just accumulated.
So there you have it, how we got seas, how they got salty and why they remain salty today. Thanks for reading.