It is true that rock layers can be correlated to each other by using fossils and matching layers.
This is because these rocks have similar, if not the same layers, which can easily be determined by the fossils that may appear on them and just using them to match the layers to see if they can correlate.