Yes, You can use expanding foam under the bathtub. An existing installation of a bathtub helps in reducing flex and coldness. However, extra problems can occur due to improper application. So, it's best not to use it without the help of a professional if you don't know the proper application.