Answer :

Marshmallows expand because they are made of foamed sugar. Microwaves heat the water in the foam and the trapped air causes the marshmallow to swell up. As soon as the microwaves are turned off, the foam collapses into a gooey puddle when the expanded air no longer feels the heating effect of the water
Marshmallows contain mostly  water and sugar. When microwaved, the water heats up, so do the air bubbles in the marshmallow, and they thus take more space. Since sugar tends to soften when heated up, the marshmallow's structure will puff up as the air bubbles expand.