When you hold a seashell up to your ear, you hear the quiet roar of waves crashing on a distant beach, as if sounds from the shell's past environment are still echoing within it.
As lovely as that concept might be, though, it's only a metaphor: When you listen to a shell, you're not really hearing the sound of the ocean. The shape of seashells just happens to make them great amplifiers of ambient noise.
Any air that makes its way into a shell's cavity gets bounced around by its hard, curved inner surfaces. The resonating air produces sound.
The pitch of the sound depends on the size of the shell. Air takes longer to bounce back and forth in a bigger shell than it does in a smaller one, so you'll perceive the pitch of sound emerging from a bigger shell as being lower than that from a smaller one. Whether high or low in pitch, almost all shells sound pleasantly ocean-like.