I get the general idea: a critter or plant dies and sinks to the bottom of a body of water where it is covered by sediment (or is buried in volcanic ash) and over time the organic remains – bones for a critter – are converted to stone.
The question I have is why does the calcium carbonate of the bones get replaced by a mineral distinguishable from the shale or sandstone matrix it is found in?
Fossilization is complex. Sometimes “fossilized” things aren’t replaced at all, as was the case with recently discovered organic material from dinosaurs, or items preserved in amber. Or the preservation of mother-of-pearl in some fossil seas shells.
When things do get replaced, it’s because something like this happens:
1.) organism dies, falls to ground or into mud or tar or silt or what-have-you.
2.) The surrounding material hardens, and may transform into a harder rock.
3.) organic material decays away inside the hardened stuff (later rock), leaving a space (probably still filled with crumbling organic residue)
4.) Mineral solution seeps into the cavity through microcracks. Water evaporates, leaving mineral behind. This happens through several cycles, the mineral eventually filling the space left behind with new, more permanent mineral. Note that this can happen in stages, with internal organs being replaced by some mineral while the later-decaying bones are replaced with another.
5.) There might be no replacement at all – some “fossils:” are simply the impressions of the outer skin. In that case, you can make a cast by filling the space with something like wax or glue or plaster. (I’ve done this with small fossils)
Fossils can form from all kinds of minerals. Here’s afind in Opal:
Bone isn’t made from calcium carbonate, it is made from hydroxyapatite. But hydroxyapatite (and calcium carbonate) is replaced when the conditions are right for it to be dissolved leaving behind a cavity that is then filled with other minerals.
It would seem that, even in the absence of oxygen, the organic material would decay faster than the mud would harden into shale leaving no cavity behind to fill.
Most fossils actually represent the inorganic material in the original organism, in particular the minerals in bones or shells. This does not decay, although as noted over time it can be dissolved and replaced by other minerals. If traces of the organic material in an organism are seen, they are usually in the form of a thin film between layers of sediment, not a cavity.