Magma is melted earth that heats up from the pressure of other rock building up underneath it. As it builds up more and more the magma gets hotter and hotter. When the volcano erupts the magma is introduced to the different air temperatures and force between in the earth and out of it. When it flows down the volcano it cools down and turns back to its original form of rock.