Sodium hydroxide solution will effectively remove aluminium from polyurethane foam, and if used in judicious concentration, perhaps molar, will leave the foam untouched.
A copper sulphate and common salt solution will have the same effect, but be a bit slower and more controllable. It may stain the foam though.
:)
To clean foam from aluminium however, heating in air at a responsible temperature, perhaps 450 C, will do the job. You will probably get cyanide, carbon monoxide, etc formed. Carbon and nitrogen will diffuse through and mingle with the outer layer of aluminium despite any oxide layer - but it ain't iron, and afaik it won't case-harden it.
There used to be a product called LS-13 which worked reasonably well (if you can get ahold of some, wet with product, wait a minute, and rinse off in water). There are still similar-ish products available to the semiconductor industry, especially those used to clean solder resist and/or varnish from boards, which will clean off many polyurethanes - but a polyurethane designed not to be removed may well not be removable, except by burning off.
Most builder's type PU foams should yield to simpler chemistry however. Try Foam Eater. Note, it's highly toxic. Very nasty stuff.
The usual solvents almost certainly won't work.