Fossils come in various forms, but generally speaking, they can be defined as mineralized bones. Fossils are not formed overnight, but they don’t require millions of years to be formed either. The key to creating a fossil is having the right conditions. During Noah’s Flood, those conditions would have been met.
While the flood waters covered the world, all of the Earth’s sediments were churning and mixing in the water. The bodies of animals that were killed during the flood were also part of that mixture. When the flood waters began to recede, the sedimentary layers spread, burying the animals within them. The minerals in those layers began to fossilize the bones, and over time the sediments hardened into rock. Had the animal been left on top of the ground rather than being buried in the sediment, then its body would have been subject to decay and weatherization, preventing it from ever becoming fossilized. This is why we don’t see dead animals on the road or in our yard fossilizing.
Below is a picture of a fish that was fossilized while it was eating another fish.