When magma cools and hardens, it forms what scientists call igneous rock. The time it takes for hot magma to turn into igneous rock varies and depends upon its composition and location.
Magma that cools and hardens above ground creates extrusive igneous rock, whereas magma that cools underground forms intrusive igneous rock. Extrusive igneous rock hardens quickly and tends to be very small. Examples of this type of rock are obsidian, pumice and basalt. Intrusive igneous rock takes much longer to cool and harden and often creates large rock. Some examples of this type of igneous rock are granite, pegmatite and peridotite.