Acoustic foam, e.g. made of polyether or polyester, with a thickness of 2–3 inch, is often used to control reverb and enhance acoustics. It works through absorption of sound, and the foam’s absorption coefficient is often given at 0.5 to 1.0 for frequencies that correspond to human speech.
Now, any sound wave will experience either reflection or absorption. The latter is what acoustic foam does to the sound of speech and other sounds, to a large degree. Then, perhaps a little unintuitively, absorption can be further divided into dissipation and transmission.
If there is, mostly, either dissipation or transmission for speech, given that the foam has a high absorption coefficient for those frequencies, the remaining question is which of the two contributes the most to the effect.
But since foam is known to reduce reverb and reflections, most of the effect cannot be transmission, right? Otherwise the sound would go through the foam, be reflected from the wall behind it, pass through the foam again and enter the room as a reflection. But that’s not happening with foam panels. So it must actually be dissipation to a high degree, which “transforms” the sound into heat, right?
However, if acoustic foam turns most of the sound into heat, how is it then not also preventing sound from leaving the room, and outside sound from entering the room (perhaps with a small gap between wall and foam)? Various sources say that such soundproofing is not what acoustic foam can do:
I explain that acoustic foam does not block sound about 5 times a day to prospective customers wanting to know how to soundproof. […] I would love to have foam that could stop sound from going through walls. I would sell a ton of it. But physics is physics. […] Even covering the wall 100% with 2” thick foam is not going to, to the extent of the person’s expectations, stop that sound from traveling right through the wall. Acoustical foam is porous and does not block sound simply because it is porous which allows sound to pass through. 
We have been fielding calls from people looking to solve sound problems for years. These callers often explain that they want sound that is being made within the room to stay in the room or they want to keep sound out of their space. […] This misconception is incredibly common […] Foam doesn’t stop a sound, it absorbs or reduces echo within the room. 
There’s no way around it: the laws of physics dictate that to block transmission, you need materials that are mass-loaded, dense and resilient. 
I have come across many people who really believe that foam is great for soundproofing spaces such as home recording studios and bedrooms. […] Foam does not work effectively for soundproofing as it has insubstantial mass to BLOCK sound whereas it is highly capable of ABSORBING sound. That is why ‘acoustic foam’ is for real and ‘soundproof foam’ is a myth. 
The kinetic energy of the sound wave moves into the air of the bass traps, absorption panels, or monitor isolation pads, which then rubs against the fiberglass threads. And when this happens, the energy is then transferred into the fibers as heat! It's then dissipated back out to the atmosphere of your room over time. 
Whether it be soundproofing against noisy neighbours, or building your own home studio we are always asked the same question regarding soundproofing foam. "Is is good for Soundproofing?" The short answer is No. Unfortunately egg box type foam does not stop sound transferring through your wall from your neighbour or from leaving your room. All it will do is absorb some of the sound within your room and stop it echoing and amplifying. It will not block sound from neighbours or escaping out of your room.