The water inside the soap is undergoing a phase change from liquid to water vapour, and expanding. The foamy effect also comes about from the expansion air bubbles trapped inside the soap. Basically by heating the soap and expanding water and air inside you end up with this lovely warm soapy foam. I used a small bar of soap and zapped it for about a minute.