Magma is believed to form deep within layers of rock and sediment below the surface of the earth. Although it is created worldwide, magma does not form everywhere below the earth's crust. Conditions must be right for creating magma, including the proper balance of temperature and forces.
The structure of the earth's internal components plays a large role in determining whether or not magma will form in a certain area and how much will be generated. Beneath the earth's surface are active seismic waves, which are produced by earthquakes around the world. Like the earthquakes themselves, these seismic waves vary in force and velocity. They also vary in length and physical composition, which influences how far they travel. These waves come in several forms, including body waves and surface waves.
Body waves travel through the middle layers of rocks, while surface waves, as the name implies, stay near the surface. Body waves are generally larger and more powerful; their progression through rocks and earthen material causes heat and forces particles upwards, resulting in the formation of magma. Magma is propelled towards the surface primarily as a solid but assumes a semi-solid combination of liquid and solid material upon contact with the surface air.