Many think the foundation of the world is right at the moment when this present earth was formed. But that’s not accurate at all. The Bible teaches that the foundation of the world is Christ’s atoning death itself. That is, when Jesus was slain as the Lamb of God and rose again His death and resurrection formed the foundation of the world. Not only for this world, but also the world to come.
Revelation 13:8 ...in the book of life of the Lamb slain from the foundation of the world.
This verse provides evidence that Jesus died before this world began. And the point before this world began is eternity past. Here’s another verse that reinforces this glorious truth:
Psalm 103:17 But the mercy of the LORD is from everlasting to everlasting upon them that fear him, and his righteousness unto children's children;
The mercy of the LORD is upon them (the elect) FROM EVERLASTING to everlasting. Right away we understand why it is said that God’s mercy is upon the elect TO everlasting. The Bible is clear that those God saved out of this world will live forever into the eternal future to come.
But why does it say God’s mercy is upon them FROM everlasting?
The reason this is said is because Christ's atoning death occurred in eternity past. And from that point of Christ’s death/resurrection in eternity past God’s mercy has been upon His elect people, "the mercy of the LORD is from everlasting".
And once again, that wonderful act of boundless mercy performed by the Saviour in eternity past was the foundation of the world.