Determine where the tub is squeaking, as this will be the point that needs reinforcement. You can either do this by walking in the tub slowly to determine the point of origin or by having someone else walk in the tub while you look under the tub around the edges to see where it is flexing.
Clean the floor and the underside of the tub thoroughly around the area where you need to spray the foam insulation. Rubbing alcohol or a common household cleaner can be used, so long as the area is completely dry before you spray the foam. Water or moisture will keep the foam from bonding to the side of the tub and the floor.
Read the directions on the can of spray foam to determine the best method for applying the foam, as it varies by manufacturer. Put on safety gear, and shake the can according to the directions and then spray it into the area that needs reinforcing between the tub base and the floor. Do not spray too much because the foam expands over time. Follow the directions for best results.