Oceans are salty because they are made up of salt water. The salt in the ocean comes from rocks on the land. When rain falls, it picks up minerals from the rocks and carries them into the ocean. The ocean has been around for a long time, so it has had a lot of time to accumulate salt.
Salt is also introduced into the ocean from under the ground. Hot water from inside the Earth seeps up through cracks in the seafloor and carries minerals with it. This is called hydrothermal vents.
Over time, the salt in the ocean gets concentrated because evaporation removes water but not salt. So, the salt that is left behind becomes more and more concentrated.