Revelation 13:8 says:
The Lamb who was slain from the foundation of the world.
It seems that God viewed the cross as an event beyond space and time.
If we read Hebrews 9:12-15, we can see and link together the three "eternals". The Lord accomplished an eternal redemption. By offering up Himself to God through the eternal Spirit, we have obtained an eternal inheritance.
It seems that the redemption of Christ has the divine eternal nature through the Spirit to transcend time in redeeming those who were thousands of years before Him as well as those who are thousands of years after Him. In other words, even if the world goes on for millions of years, Christ's redemption is still effective.
Watchman Nee, in his book, Fact, Faith, and Experience, says:
If the blood of bulls and goats was not able to remove sin, as we
mentioned earlier, how then were those in the Old Testament saved? It
was by the cross. Man had sinned. Hence, only a man could accomplish
the redemption of sin. Although the animals were innocent, and
although they were without blemish, they could not redeem man from his
sins. Why then did God promise in Leviticus 17 that the blood of
creatures was able to redeem one from sin? There must be some very
profound meaning here. The things of the law "are a shadow of the
things to come, but the body is of Christ" (Col. 2:17). Hence, the
sacrifices and the offerings in the Old Testament all refer to Christ.
Although Christ had not yet died at the time of the first covenant,
God intended that all the sacrifices offered at that time be a type of
Christ. Their death was taken as the death of Christ. Through the
blood of many animals, God saw the blood of His beloved Son. Through
many bulls and goats, He saw "the Lamb of God." Through the many
sacrifices, He saw the substitutional death of Christ. When He
accepted those offerings, it was as if He was accepting the merit of
the death of His Son. Because of this, man was redeemed from his sins.
God reckoned the innocent bulls and goats as His dear Son. Hence, He
could forgive the sinners based upon the sacrifices they offered.
Every time the offerings were slaughtered, they spoke of the coming
sacrifice of the Son of God as the sin offering on Golgotha and of His
accomplishment of the eternal work of salvation. Because the Lord is a
man, He is able to redeem man from sin. Because He is God, He is able
to redeem all men, past and present, from their sins.
Those who offered the sacrifices in the Old Testament, consciously or
unconsciously, believed in a coming crucified Savior.