Sound travels as a back-and-forth vibration of the particles of its medium. It is a longitudinal mechanical pressure wave that varies greatly in its speed of travel and the distance it remains coherent, dependent upon the medium. Sound in air travels relatively slowly and for a short distance, while sound in a solid, such as the primary waves of an earthquake, travel extremely quickly and to great distances.
In general, the denser and purer a medium is, the better sound travels through it. The pressure waves that compose sound are easily disrupted. For instance, despite the fact that solids carry sound more quickly than gases, pillows muffle sound because the sound must transition through different phases of matter, which disrupts them. Similarly, water carries sound better than air, but sounds made underwater are difficult to hear in the air above it.
Sounds travel so much quicker through liquid and solid media because they are not easily compressible. Gas molecules, by definition, have large amounts of space between them and are disconnected from one another, so making individual particles momentarily move toward or away from one another is relatively trivial. Liquid particles, on the other hand, are in contact already, so compression actually squeezes them together. Solids are not only in contact but are held together with rigid bonds.