Gases cause pressure beneath the earth. The gases come to a head and push molten magma to the surface. The magma cools. With enough time the pressure builds up greatly. The resulting volcano may explode. 
What causs a volcano to erupt?