Underground, they are formed when the melted rock, called magma, deep within the earth becomes trapped in small pockets. As these pockets of magma cool slowly underground, the magma becomes igneous rocks. Igneous rocks are also formed when volcanoes erupt, causing the magma to rise above the earth's surface.When magma appears above the earth, it is called lava.Igneous rocks are formed as the lava cools above ground. Source(s):gneous rocks are also formed when volcanoes erupt, causing the magma to rise above the earth's surface. When magma appears above the earth, it is called lava. Igneous rocks are formed as the lava cools above ground. Source(s):