Fossils are naturally preserved in rocks. When a plant or animal dies, its body may become buried in sediment, such as sand or mud. Over time, more layers of sediment can accumulate on top, which can compress and harden the lower layers into rock. As the body decays, minerals from the surrounding sediment can seep into the bones or other hard parts, replacing the organic material with rock-like minerals. This process is called fossilization, and it can preserve the remains of the organism for millions of years. Later on, erosion and weathering can expose these fossils, allowing us to study and learn about the organisms that lived long ago.