In the case of a closed box, the air inside the box exerts pressure on the woofer which impedes its motion, raising the resonance frequency and creating a 12dB/octave high pass filter. The smaller the volume, the higher the resonance/cutoff.
In the case of a ported speaker, the port is a Helmholtz resonator: a region of air having lower acoustic impedance than the air from which the sound wave is propagated (in this case, the air behind the woofer inside the box). When sound is reflected through such a low-impedance region, its phase is reversed. Since the phase of the back wave of the woofer is already out of phase with the wave coming from the front of the woofer, when the back wave’s phase is reversed by the port it ends up exiting the port in-phase with the front wave (except below the frequency of the ported box's resonance frequency, where the port is ineffective). The result is that the outputs from the port and the front of the woofer add constructively from the resonance frequency up, which a sharper (24dB/octave) roll-off below the resonance frequency due to cancellation between the port's output and the output from the front of the woofer (due to their being out of phase below this frequency).
In reality, box materials are not infinitely rigid or reflective, and boxes are not infinitely tightly sealed, so there are losses and unintended resonances that contribute additionally to the output. By this I mean that:
- panels vibrate much like a speaker, especially at particular frequencies defined by cabinet geometry and materials
- sound passes through panels
- sound escapes through gaps in the panels or e.g. through the woofer’s cone or dustcap etc
This can of course be audible if it’s significant enough.
In most high quality speakers since the 80s, losses and resonances have been quite well suppressed. I believe Celestion is widely credited with making the first serious attempt to address this issue in the late 70s, but I’ve forgotten which model it was now. Even long before this though, it was understood that losses and resonances were theoretically undesirable, and
some effort was made by various manufacturers to brace cabinets, use thicker ply or other materials, etc (to the best of my knowledge - I wasn’t actually around back then
)