The foam is merely the ocean water whipped up by a wild storm. This is quite normal in surf to a minor degree, but the cyclone generated so much more. I understand that one critical factor is the presence of organic matter derived from the breakdown of algae present in the water.
About a month earlier than this, I was flying along the coast and observed an algal bloom in the ocean near the coast, all the way from northern Fraser Island to the Sunshine Coast - this photo above having been taken on the Sunshine Coast at Mooloolaba. (I have uploaded a couple of images of the algal bloom.)
Because there are rivers emptying into the ocean nearby (Maroochy and Mooloolah Rivers), there was also some flood discolouration of the water. Of course, I waded into the foam, and the foam was not only quite dirty (from the river floods) but also carried quite a lot of sand grains with each bubble, so my clothing needed washing afterwards both to clean and remove the sand. The foam and sand tend to be surprisingly sticky.
It is not the result of soap or other pollutants in the water.