We saw this on our hike today and we'd never seen it before. Here's what Mr Google has to say about it: Nature’s soap
“As rainwater trickles down the tree stem or trunk (called stemflow), it collects deposited dust particles (i.e. salts) and plant residues (i.e. acids) that have accumulated on the bark surfaces. Bubbles are formed through the process of “stemflow mixing”. As this dissolved, simple soap solution flows down the trunk, it encounters barriers and bumps, like bark plates, furrows, and ridges. The solution is then tumbled, mixed and aerified, during its downward flow to the ground, generating the bubbles or soapsuds, which collect at the tree base. Occasionally, a light coating of foam may even be visible higher up on the tree trunk. Stemflow mixing has no known deleterious effect on tree health.”
What an interesting explanation! We have lots of trees ( eg a native "foambark") that do this and I've never really known why - that's for putting this image and this info up. :)