The frothy appearance of pumice and scoria is caused by the aggressive eruption from volcanic which shoots the lava out filling it with gas.
Both pumice and scoria are extrusive rocks. They are usually molded outwards of the volcano, especially at the upper part of the lava flow. The upper part of the scoria turns extremely frothy and after they must have cooled down. The air in the lava then expands and breaks free creating an air hole in the rock.