If a sedimentary rock is buried underground, two of the forces it has to deal with are pressure and heat.
Pressure comes from the incredible weight of material surrounding the rock on all sides.
Magma, pushed up from deep within the earth, may come in contact with the sedimentary rock, heating it and causing chemical, mineral, and physical changes. Temperature changes in the sedimentary rock can also occur from contact with heated water deep underground. The heat again causes changes in the rock in a process called hydrothermal alteration . In any event, the rocks have changed, and are transformed into a completely new classification of rock, known as metamorphic.