The gospel was preached in Old Testament times
Hebrews 4:2 (KJV) For unto us was the gospel preached, as well as unto them: but the word preached did not profit them, not being mixed with faith in them that heard it.
“Them” refers back to chapter 3 where we read about the Israelites in the wilderness. They were not saved by works or sacrifices. They too had to trust in Jesus Christ as saviour.