an imrint of the skeleton stays in the mud, even afer the skeleton itself disintegrates. many years pass.
the mud with the fishs imprint gradually hardens and turns to stine under the pressure of the rock layers that have subsequently built up on top of it.