Many gels that foam will not go back to their original constituents. It's a one way street that usually ends up in a very hard substance.
But if you look at something like the mucus of the hagfish, you might have something. The hagfish will turn the surrounding water into a goo (reaction between sea water and mucus). I'd imagine you could foam that up much like you can do with the yolk of an egg (another possibility). It's easier to look at existing organic compounds than mess with man-made crap. But do you want a hagfish in your body?