Salt in the ocean comes from rocks on land. Here’s how it works:
The rain that falls on the land contains some dissolved carbon dioxide from the surrounding air. This causes the rainwater to be slightly acidic due to carbonic acid (which forms from carbon dioxide and water).
As the rain erodes the rock, acids in the rainwater break down the rock. This process creates ions, or electrically charged atomic particles. These ions are carried away in runoff to streams and rivers and, ultimately, to the ocean. Many of the dissolved ions are used by organisms in the ocean and are removed from the water. Others are not used up and are left for long periods of time where their concentrations increase over time.
Two of the most prevalant ions in seawater are chloride and sodium. Together, they make up over 90 percent of all dissolved ions in the ocean. Sodium and Chloride are ‘salty.’
The concentration of salt in seawater (salinity) is about 35 parts per thousand. Stated in another way, about 3.5 percent of the weight of seawater comes from the dissolved salts; in a cubic mile of seawater, the weight of the salt (in the form of sodium chloride) would be about 120 million tons.
By some estimates, if the salt in the ocean could be removed and spread evenly over the Earth’s land surface it would form a layer more than 166 meters (500 feet) thick, about the height of a 40-story office building.
More information here.