Any geology or paleontology brahs? answer me this...

Can fossils form in non sedimentary environments?.... Say like if an animal was sandwiched suddenly between two massive bits of clay, could that form into a rock. Would that still be sedimentary?

Is that a thing?

Thanks