Detergent and fabric softener are the biggest culprits. When washing swimwear, detergent and fabric softener get trapped in the fabric. If you then enter the spa wearing clean swimwear, chemicals are released and the spa may suddenly foam more than you might like. Foam in the spa can also be caused by soap residue in your hair and on your skin, or by residues of gel, body lotion, or sunscreen, for example. Rinsing yourself off, including your swimwear, under a tap before entering the spa can therefore prevent the problem.
If you do have foam in the spa, you can remove it with an anti-foam agent. You only need a very small amount, and it works very quickly.