I'm more concerned about the noise. It sounds more like air in the pipes and the foam won't help. You would need to create an air chamber in the wall.
As far as the expansion foam, it is polyurethane and the fumes are hazzardous. On the other hand it sets in a couple of hours and I can't say I have noticed a smell from it after then.