When God called them and in reality even before they were born.
God called Abram. God elected Isaac before he was conceived. Same with Esau and Jacob.
Acts 15:14-17 says a lot about the salvation of man and here is what verse 18 says, Known unto God are all his works from the beginning of the world.
For as in Adam all die, even so in Christ shall all be made alive. But every man in his own order: Christ the firstfruits; afterward they that are Christ's* at his coming. 1 Cor 15:22,23
The OT saints those who had the Holy Spirit died in the faith of the Abraham. The died in the bosom of the Abraham the very same as those who have died since the resurrection of Christ, die in Christ. They are Christ's.
* And if ye be Christ's, then are ye Abraham's seed, and heirs according to the promise. Gal 3:29
V16 Now to Abraham and his seed were the promises made. He saith not, And to seeds, as of many; but as of one, And to thy seed, which is Christ.
Rom 4:1 What shall we say then that Abraham our father, as pertaining to the flesh, hath found?
Rom 4:2 For if Abraham were justified by works, he hath whereof to glory; but not before God.
Rom 4:3 For what saith the scripture? Abraham believed God, and it was counted unto him for righteousness.
Rom 4:4 Now to him that worketh is the reward not reckoned of grace, but of debt.
Rom 4:5 But to him that worketh not, but believeth on him that justifieth the ungodly, his faith is counted for righteousness.
Rom 4:6 Even as David also describeth the blessedness of the man, unto whom God imputeth righteousness without works,
Rom 4:7 Saying, Blessed are they whose iniquities are forgiven, and whose sins are covered.
Rom 4:8 Blessed is the man to whom the Lord will not impute sin.
Rom 4:9 Cometh this blessedness then upon the circumcision only, or upon the uncircumcision also? for we say that faith was reckoned to Abraham for righteousness.
Rom 4:10 How was it then reckoned? when he was in circumcision, or in uncircumcision? Not in circumcision, but in uncircumcision.
Rom 4:11 And he received the sign of circumcision, a seal of the righteousness of the faith which he had yet being uncircumcised: that he might be the father of all them that believe, though they be not circumcised; that righteousness might be imputed unto them also:
Rom 4:12 And the father of circumcision to them who are not of the circumcision only, but who also walk in the steps of that faith of our father Abraham, which he had being yet uncircumcised.
Rom 4:13 For the promise, that he should be the heir of the world, was not to Abraham, or to his seed, through the law, but through the righteousness of faith.
Rom 4:14 For if they which are of the law be heirs, faith is made void, and the promise made of none effect:
Rom 4:15 Because the law worketh wrath: for where no law is, there is no transgression.
Rom 4:16 Therefore it is of faith, that it might be by grace; to the end the promise might be sure to all the seed; not to that only which is of the law, but to that also which is of the faith of Abraham; who is the father of us all,