Hi
Yes - Apple advises that Apple Watch Series 2 can be worn during shallow water activities, including swimming in the ocean.
Note that leather and stainless steel bands are not water resistant, so should not be worn in the ocean.
After swimming, be sure to clean your Apple Watch by gently rinsing it with warm tap water. The watch and band should be dried using a soft, lint-free cloth.
More information: