One could, to follow your line of questioning, ask how could Jesus die and pay the sin debt for sins that had not even been actually committed yet?
To answer the question that you asked:
"Justification involves God in eternity, before the foundation of the world, sovereignly and unconditionally choosing His people in His Son, the Lord Jesus Christ, and literally giving them to Christ, entrusting their whole salvation to Him. This means that God conditioned the whole salvation of His chosen people on Christ and the work that Christ would come in time and accomplish for them by His obedience unto death. In other words, God the Father made Christ to be the Surety of His people. Christ is the Surety of the New Covenant (Hebrews 7:20-22), and the New Covenant is the actual fulfillment in time of all the conditions of the everlasting Covenant of Grace made before time. Christ has always been the Surety of the everlasting Covenant of Grace. A surety is one who is made responsible for the debt of others. This is when Christ obligated Himself to come in time and pay the redemption price with His blood (His death) for their sins on the cross. So, what God had purposed before the world began was always sure and certain to be accomplished in time because Christ was (and is) the Surety of the covenant (2 Corinthians 1:20). So, it can be said that God’s people were JUSTIFIED IN ETERNITY in the eternal mind of God as Christ has always been (and always will be) their Surety. This justification was always based upon what Christ would come in time and accomplish for them on the cross. Revelation 13:8 expresses this in a negative by speaking of those who in the end would reject Christ and worship the unholy beast (the agent of Satan) and describes them as those “whose names are not written in the book of life of the Lamb slain from the foundation of the world.” This clearly indicates that all for whom Christ was made Surety and for whom He would come in time and redeem them from their sins are those whose names were written in the Lamb’s book of life (Revelation 21:27) before God laid the foundation of and created this world.
We must realize that if we believe what the Bible teaches, there has never been a time when God viewed His people outside of Christ and without the merits of His death on the cross to be accomplished in time. Even when God’s chosen people fell into sin and death by Adam, and even when they were (and are) born spiritually dead in trespasses and sins (by nature no different than the children of wrath), they were (and are) covered by God’s everlasting covenant of grace in Christ and based on His righteousness imputed to them. This is in line with the Biblical revelation that all who are saved by God’s grace were (and are)
“the vessels of mercy, which He had afore prepared unto glory” (Romans 9:23), and objects of God’s “purpose and grace, which was given us in Christ Jesus before the world began” (2 Timothy 1:9)."
- excerpt from Bill Parker's book,
https://n.b5z.net/i/u/10086795/f/When_Are_Gods_People_Justified_in_His_Sight_new.pdf