Rain falls as fresh water. As this water flows downward, it ever so slightly erodes the rocks and soil. This causes a very slight amount of salt and minerals to dissolve in the water. Then they continue downstream. Eventually, all the dissolved minerals get dumped into the ocean.
Meanwhile, water on the ocean's surface evaporates. That means it goes into the air. It ditches all those salts and minerals. Then it falls back on land as fresh. In lakes and rivers, theres enough turnover that the water stays fresh. But in the oceans, the salts pretty much stay there.
Rivers dump about 4 billion tons of salts into the oceans each year. Even with all that new salt, the oceans are just so big. Their salinity stays fairly constant, at about 3.5%.