Volcanoes form when hot material from below rises and leaks into the crust. This hot material, called magma, comes either from a melt of subducted crustal material, and which is light and buoyant after melting, or it may come from deeper in the interior of a planet and is light and buoyant because it is *very* hot.
Magma, rising from lower reaches, gathers in a reservoir, in a weak portion of the overlying rock called the magma chamber. Eventually, but not always, the magma erupts onto the surface. Strong earthquakes accompany rising magma, and the volcanic cone may swell in appearance, just before an eruption, as illustrated in this picture. White arrows in the picture show the volcano getting bigger as magma rises inside. Scientist often monitor the changing shape of a volcano, especially prior to an eruption. The different reasons why a volcano forms are
source: windows to the universe