Sedimentary rocks are formed when soft sediments are buried and hardened by heat and pressure. The soft sediments may contain the remains of living things that are buried with the soft sediments from erosion. The remains of living things are called fossils, coal is an example of a fossil.
Metamorphic Rocks may have been sedimentary rocks. Metamorphic rocks are the result of higher heat and pressure. The fossils that may have been in the sedimentary rocks are most often destroyed by the resulting heat and pressure.
Igneous rocks are melted rocks. Sedimentary rocks that are formed in the deep ocean bottom are carried by tectonic plates to subduction zones. The sedimentary rocks are pushed deep under the continental plates where the heat of the mantle melts the layers of sedimentary rocks. This results in magma that may form volcanos becoming lava, or hardened under the surface become granite or basalt. Any fossils that were in the sedimentary rock become liquid and are destroyed.
The only rocks that can contain fossils are sedimentary rocks that have not been changed by too much heat and pressure.