Fossils can give information about past environmental conditions by showing the type of animal they belonged to. If a scientist found a whale fossil in a desert, he/she could assume that the desert was once an ocean as whales only live in oceans. If someone found a fossil of a lizard that inhabited trees, in the middle of the ocean, then he/she could assume that the ocean didn't exist at one point and instead, there might have been a forest in it's place.
Hope this helps!