A metamorphic rock is a changed rock. It is formed when sedimentary or igneous rocks are exposed to high temperatures and or pressures.
The heat of a volcano can affect the nearby rocks that are exposed to the high heat of the magma, transforming them into metamorphic rocks.
When sedimentary rocks are push/pulled down deeper into the crust at a subduction zone the rocks are subjected to high pressures the pressure can compact the sedimentary rocks turning them into metamorphic rocks. Limestone is hardened into marble.
Meta means change. This helps to remember that metamorphic rocks are changed rocks.
Foliation in metamorphic rock is formed by uni- or bi-directional strain, often under high temperature and pressure conditions, that allow laminar deformation along planes of weakness between layers, mineral grains, and molecular bonds. The foliation, often sheet-like planes with altered mineral composition, can often indicate the direction of increased strain and inform regional stress and plate tectonic analysis.
The types of minerals present can indicate different levels of temperature and pressure. See various temperature/pressure diagrams for P/T conditions associate with certain mineral assemblages, as many are different depending on what minerals were present.