Freecycle can potentially be good for this. You appear to be specifically searching for furniture foam, aka flexible polyurethane foam. You'll sometimes see it used in packaging, and that can be the source of a lot of it being thrown away.
If you can find a "pull-your-own parts" automobile junkyard, car seats are filled with excellent high-density flexible foam. I have no idea what the going rate for that foam would be. When cars are crushed for scrap, I know that the foam is shredded and sent to a landfill, so it shouldn't be worth all that much.
Another potential source is from discarded furniture. High density apartments in particular often have a random couch being thrown away. The only concern involves bedbugs. Leave the covers behind and just take the foam. Bedbug eggs are effectively invisible. To be completely safe, you need to heat this foam up to 150F for a few minutes. You can do things like put it in a foil-lined cardboard box with a heatgun or hairdryer, run it through your clothes dryer, saturate it with boiling hot water, or treat it with a steam-cleaning device. You can cut the foam up into smaller pieces and glue it back together pretty effectively if that makes this process easier.