Also, some reptiles, such as lizards, are known to leave their old skins behind, which can appear similar to foam when they dry. Amphibians may lay egg sacs that look like pink jelly at first, but then they dry up and become hard. Although it is uncommon for these events to happen indoors, it is still possible, especially if your building has openings that allow these creatures to enter easily.
In certain damp places, you might find fungi growing, especially in places like Queensland. However, this particular event does not have the usual characteristics of fungus, like a soft feel or visible spores.
Without looking into it more or it happening again, it's difficult to say for sure what the substance was. If it comes back, it may need more attention to check for problems like leaks, mold, or hidden gaps in the wall.