The modern automobile is born from an idea, virtually
designed on a computer, and once the engineers are satisfied with
their product, factory workers make and assemble the vehicle. In
much the same way, before the Godhead ever began the creation, God
the Father, God the Son and God the Holy Spirit planned the creation
in their minds. God then performed a time run involving events,
angels, and human beings, allowing Him to see how each angel and
person would live and the decisions they would make.
Thus, God has the capacity to know the future before it happens in
the physical world. He used this omniscient ability to inform the
prophets in the Old Testament of future events. Hence the Godhead
exists outside of time as we know it, controlling the past, present
and future at the same time, and preparations were made to send
Jesus to the earth so the Son of God could pay for the sins of
humanity and make it possible for people to be redeemed.
God could easily do these things because He isn't linear like
mankind, existing outside of time, reaching in and interacting with
us when it suits Him.