When metamorphic rocks undergo pressure they are changed, but how are they changed? Do they become fragments of rocks? Doesn't that mean that the difference between sedimentary rocks and metamorphic rocks (when talking about fragment rocks) is that sedimentary rocks undergo weathering, which makes them fragments and metamorphic rocks undergo immense pressure which makes it into fragments?
Metamorphic rocks are changed by transformations deep underground. Being deep underground there is immense pressure and heat.
The transformations can be just crystal size of the particular mineral, or different minerals can be in fact formed. For a particular mineral there are also may be different crystal structures which depend on the pressure and temperature at which the crystal was formed. The different compositions and crystal structures would be shown on geochemical phases diagrams. Geochemical modeling could be used to predict the various reactions based on the temperature and pressure profile to which the material is subjected.
Metamorphic rocks are formed when a rock (sedimentary, igneous or a previous metamorphic rock) comes under high pressure and/or temperature. Pressure and temperature forces the atoms to form new minerals and thereby a new kind of rock. It's not necessary fragmented, but the rock rather morph through recrystallization into a new state in response to the pressure and temperature as the material reorganize.
Recrystallization doesn't remove any material, it's only a physical reorganization to compact the rock. If some change of the chemical composition occurs, it's called metasomatism. In metasomatism atoms are actually moved from one part of the rock or formation, often with water involved.
A good petrologist can usually determine what kind of parent rock, protolith, that have been metamorphosed and to what degree, but sometimes it can be difficult do recognize the difference. At lower degrees of metamorphism, features of the original rock is preserved. E.g. you can see ripples and even fossils in slates or deformed structures from the source rock, but at higher degrees of metamorpism it's increasingly difficult to imagine how the parent material looked like. Gneiss formed from sandstone and granite can look very similar as the lihology represents the conditions of metamorphism, not the protolith.
It can also be difficult to recognize a metamorphic rock. A weathered slate and shale or even granite and gneiss can appear very similar in the field. However, the processes to form the rocks are different and with a closer look at the minerals it can be possible to understand what kind of process that formed the rock.
(1, Blueschist facies 2, Eclogite facies 3, Prehnite-pumpellyite-facies 4, Greenschist facies 5, Amphibolite-facies 6, Granulite facies 7, Zeolite facies 8, Albite-epidote-hornfels facies 9, Hornblende-hornfels facies 10, Pyroxene-hornfels facies 11, Sanidinite facies)
The temperature and pressure determine what metamorphic rock you get, but the chemical composition is inherited from the protolith. Degrees of metamorphism are called metamorphic facies. This diagram shows at what depth and temperature a particular rock is formed.
Igneous rocks are formed when a melt hardens to crystals and sedimentary rocks are formed from sediments. All rocks weather if exposed to water and air, and weathered material is transported by rivers to oceans where sandstone can be formed from the sand at the beach and shale from the finer sediments further away from the coast. Igneous rocks can be formed as hot magma intrudes the crust and slowly cools down and minerals are formed or form lava at volcanoes. This is known as the rock cycle and is one of the fundamental, but complicated, concepts in geology. You can read more about the rock cycle e.g. here to learn more about rock types and how they are formed.
The existing answers are correct but I think they miss an important aspect of your question, which is the effect of pressure.
Do they become fragments of rocks?
No. Fragmentation of rocks is a relatively low temperature and pressure process. This is the kind of stuff you would see in near-surface environments. Once rocks become hot under pressure, they are no longer brittle but are ductile. This means they can bend and flow. Think of chocolate: put it in the freezer and it's hard as a rock, but if you take it out (when it's still solid) it becomes easier to bend it and shape it with your hands.
Same with rocks. A very common feature of metamorphic rocks is folding:
Doesn't that mean that the difference between sedimentary rocks and metamorphic rocks (when talking about fragment rocks) is that sedimentary rocks undergo weathering, which makes them fragments and metamorphic rocks undergo immense pressure which makes it into fragments?
No. The immense pressure actually works well to hold everything together instead of fragment them. There is some fragmentation in metamorphic rocks, but it's usually manifested as faulting rather than fragmentation into pieces (also known as brecciation). Here's an example:
Metamorphic can have been halfway to the state of lava for a short time, it may have been like quite tough dough of bread. You can imagine the viscosity of it to be the same as ordinary glass which is at 200 degrees, if you have a window at 200 degrees, you can bend it into a U shape in a time ranging from 20 minutes to 20 seconds depending on the temperature it is at, it becomes more malleable. instead of sand, metamorphic is hot limestone/clay/pebbles...
The dough slowly moves and deforms, for example by pressure of buckling tectonics from distant tectonic shocks like rising mountain chains. The chemicals inside the dough disamalgamate and coagulate into chemicals that have easy bond affiliation. Every chemical reacts differently and has more or less strong bonds at a set pressure of metamorphism, different blobs inside the metamorphic rock may be more or less mobile and viscous. You get crystals of different sizes of new materials, more often roundish, sometimes flat (gneiss) indicating the flow/pressure in the dough, the crystals branch out not that differently from ice crystals, they recrystallize re-mineralize. The time and pressure of metamorphosis vary a lot and determine the level of change that happens.