Although sound can travel through water, it will be distorted compared to sound traveling through air. As sound waves pass through the water, they are attenuated and slowed, leading to frequency warping and decreases in amplitude.
Sound travels through any medium with mass. A sound is a wave that passes through the material. The energy of this wave displaces the matter in the medium, transmitting the sound across the medium. Water readily accommodates such waves. The mass and density of the water, however, resists some of the energy of the sound wave, distorting the sound.
Sound passes through air because there is matter in the air to be displaced, and thus, carry the waves. In an environment without any matter, such as in the vacuum of space, sound cannot travel.