Check the balance
of your water. If it is OK, then it is safe. The presence of the foam has nothing with microbiological contamination or infection. However, if the issue is a
high TDS level
, swimming can cause skin and eye irritation.