There's a lot we can learn about animal history from fossilized fecal matter. But first things first:
How does it poop become fossilized?
One would think it would be fairly hard for feces to fossilize considering its many other possible fates. It can be eaten by another animal, digested by microbes, washed or blown away, not to mention a number of other possibilities. But if the animal who left the feces were a carnivore, the good news is that its feces probably contains bone material which contains calcium and phosphate, and together they make up a compound important for fossilization. That is, calcium phosphate is largely responsible for turning soft feces into a hard fossil. And considering how often an animal has to go in its lifetime versus how many times it dies, studying fossilized feces isn't a bad idea.
What's the big deal?
Fossilized feces, also known as coprolites, can show us a lot about the lifestyles of the animals that left them behind. From them we can decipher what those animals ate, as well as information about their habitats. The real difficulty in studying coprolites is identifying who deposited them. Some dinosaurs have left behind some awfully large specimens, measuring as much as 2.5 quarts in volume and as much as 16 inches in diameter.
"Fecund Feces" (The Why Files)
"Types Of Fossils and What They Tell Us About The Dinosaurs" (Enchanted Learning)