Can I use expanding spray foam to support a cracked bathtub?
I highly doubt that spray foam will provide much support. In addition to the tub itself, water is heavy - ~ 8 lbs./gallon - and you could easily have 50 gallons, > 400 lbs. of water in a bathtub.

Foam is great for insulation (because of the trapped air), and depending on the type of usage, can be very good for filling cracks. But unless it were specifically engineered to do so, I would not expect any consumer foam to be able to support any significant weight. If you were to fix the crack properly first (in the case of a bathtub (or anything with a liquid) foam would not normally be enough to seal the crack by itself), I would make sure there was plenty of support to prevent future movement == future cracks. Foam, in this context, is filler and not support.