I've never seen "foam in a can". The closest thing I can think of is specialized window sealant foam, which remains somewhat flexible to maintain a seal despite temperature changes and mechanical stresses.
I believe what you're looking for is called an open-cell foam and the canned stuff is all closed cell.