Your sample was once boiling hot molten rock, magma. Pumice is usually formed when volcanoes explode. Volcanoes explode when there is lots of gas bubbles trapped in the magma. As the gas pressure builds, it eventually causes an explosion. When that happens, the magma is torn apart into many small pieces that still have gas bubbles in them- we can call these bubbly shards of cooled magma pumice. When it is still hot, the pumice and gas escape quickly from the vent, producing lots of explosions as they do.