There are many horror stories of people doing serious damage to parts of their home such as bowing out windows by insulating with spray foam. It expands and has tremendous force when it does, you could actually pop the tub up from where it is resting!
Insulation foam comes in two versions one expands less then the other, at least buy that one.
If you have an access panel ( you may not ) it would be located opposite the on/off valve in your tub. So where ever your bath faucet is look at an area that is behind it.