This is an interesting question, because it is misleading in certain ways, which I’ll explain later.
A “sound wave” is basically a periodic change of air pressure and particle velocity. If you imagine a long tube with a short plug inside that you’d be shoving in an out with a stick, this is what would happen: as long as you shove it down, you’d increase air pressure (and shove air down the tube). As long as you pull it out, the opposite would happen.
As always with devices that produce sound for human ears, the details are rather tricky. To produce the intended result (undistorted playback of music), you’ll have to consider far more than the actual solenoid and membrane that make up a speaker. Due to “Newton’s Axioms” (basically, laws of nature that nobody ever has observed to be violated), every force (which the speaker excerts on air before it) will be counteracted by an equal, but opposed force. This is how “inertia” works, for example. So, when the earplug starts to play a bass note (maybe a low, soft note on an e-bass, for example), it will pull at its “cage”, as it is called, at the parts holding the actual speaker. These will pull at the skin in your ear channel, the skin will pull at your skullbone. When all of this would give way (which it can’t), your question would show why bass notes would sound funny, because in the end, even your inner ear would be pulled and then register another sound being “played”. Which didn’t come in through the eardrum, but through the bones. Obviously, that doesn’t happen.
The ear plug sits “tight enough” so that it’s not a problem for the plug to compress the air inside the ear channel further, even if the wave ran all the way to the eardrum already. This you can even hear: if you unplug a plug slightly, music playing back sounds differently. Technically speaking, it’s a matter of dampening and impedance, and the ear itself is already quite good at this. No wonder, it should catch every bit of acoustic energy running down the ear channel to hear finely.
Latest Answers