Metamorphic rocks form deep within the Earth when heat and pressure are applied to either igneous rocks or sedimentary rocks. This heat and pressure in essence cooks the rocks, changing their structure substantially.
The rocks are partially melted and the chemicals within them are rearranged so that the final rock is very different than the original rock.
The final state of a metamorphic rock depends on the amount of pressure the rock was subjected to, the amount of heat the rock was subjected to, and the amount of time the rock was subjected to pressure and heat.
One very common metamorphic rock is marble. Marble is formed when heat and pressure are applied to limestone for many thousands of years.