You find fossils in sedimentary rock. Sedimentary rock is made of particles such as sand, mud and shell fragments that settle in layers and are later pressed and cemented together. Common kinds are sandstone, mudstone and shale, and limestone. The conditions are gentle enough that a bone is not crushed or melted.
It is very unlikely that you find a fossil in igneous rock, which forms from molten rock at hundreds of degrees. Metamorphic rock, which has been heated and squeezed, usually destroys fossils or stretches them out of shape. Volcanic ash that settles and hardens can bury animals and plants, and, as World 7 shows, these ash layers are very useful for dating.