Imagine you have a child around 6 or 7 years old (you might already have one or have older children, making this exercise much easier). Your child receives twenty dollars from a relative as a gift, and you promise to take them to the store to spend the money on something they would like.
You know what your child will probably buy if you take them to a candy store. You also know what they will probably buy if you take them to a toy store. You also know what they will probably buy if you take them to a toy store.
However, knowing what they will buy does not override their free will. Your knowledge of what they will buy in each situation comes from your knowledge of the child rather than your control over it.
In human affairs, then, we recognize the difference between knowing something and causing it.
Why should it be different when dealing with God's knowledge and power? It shouldn't.
Choosing where to take the child can be called a possible world. The idea of making different decisions and creating different versions of history is widely explored in science fiction, fantasy, and even everyday life.
"What if I had met her earlier?"
"What if I hadn't done that and still had that job?"
"What if my father hadn't died when I was twelve?"
We all think through what might have happened; it's a natural part of how humans think.
We can think ahead much further than the immediate consequences of any decision, such as which toy, candy, or book your child might buy. Each decision sets a long chain of events in motion, leading to a completely different outcome. If your child buys a toy doctor's bag, they might be inspired to become a doctor. If they buy an erector set, they might be inspired to become an engineer.
The things that might have been can are also one class of counterfactuals.
Human knowledge of these counterfactuals is quite limited. The further we try to look into the future, the murkier and less accurate our predictions (or projections) become.
However, we know that if a child is inspired to become a doctor, they also cannot be inspired to become an engineer. There are possible worlds with self-contradictory outcomes or contradictory counterfactuals.
Let's try to extend this case to God.
Before jumping into this, however, remember we are not trying to "psychoanalyze God." The only things we know about God and God's mind are revealed in the Scriptures. We are not concerned with finding the answer to how God thinks or any such thing. We are just looking for a perspective that allows us to make sense of what the Scriptures say.
If the law of noncontradiction is part of God's character (God will not contradict himself), and this carries over into God's created world (the law of noncontradiction holds in this world), God is faced with choices, too. If God creates a world with creatures who have free will, he cannot also create a world that is guaranteed to be free from all evil.[1]
One other thing we also know is that God is omniscient. If we, as humans, know some counterfactuals and God's knowledge is greater than ours, it only makes sense to hold that God knows all counterfactuals.
In other words, God knows the entire path of history, from the beginning to the end, and how history would change if any individual human decided other than the decision they make.
Since God created this world—the one we live in—he doesn't need to sit around waiting to see what color of shirt you might wear this morning and which of the possible future will happen. Instead, because he is omniscient, God knows every possible decision anyone might make, the results of each of these decisions, and every decision every person makes.
God, the moment before the creation described in Genesis 1:1, knew every decision every person would make throughout history.
Like the parent taking a child to a store, God does not make every decision. Just as the parent might take the child to the bookstore rather than the candy store, God can set up history to achieve his ends before history even began.
In creating this world, God carves out space for human free will.
Free will is limited rather than absolute. There are things we know God predestines—the birth and life of Darius, the life of Christ, etc.—and there are something God does not predestine.
God does not predestine how many times Joash will hit the ground and how many arrows he will shoot—but he knows how many times Joash will do these things. God does not predestine Cain's sin—but he knows how Cain will react to being confronted with the choice of sinning.
Is there any Scriptural evidence that God knows what might have been? One of the clearest cases is Matthew 11:21–23—
Woe to you, Chorazin! Woe to you, Bethsaida! For if the mighty works done in you had been done in Tyre and Sidon, they would have repented long ago in sackcloth and ashes. But I tell you, it will be more bearable on the day of judgment for Tyre and Sidon than for you. And you, Capernaum, will you be exalted to heaven? You will be brought down to Hades. For if the mighty works done in you had been done in Sodom, it would have remained until this day.
We could, of course, read this as a bit of hyperbole—Jesus is just using the wicked Cities on the Plain to illustrate a point. A more natural reading (and remember, we're trying to read the Scriptures naturally) is that Jesus is describing what would have happened if circumstances were different than they are.
The most natural way to read this passage is as a counterfactual—something that could have been true (but is not).
Essentially, "possible worlds" is simply a way to think about how God can know things without causing them. From our perspective, we do not always know when God causes things and when he does not. We know God divided the waters of the Jordan so Israel could cross over; we can infer he caused Ruth to glean in Boaz's field; we have no idea if God caused me to wear a green shirt instead of grey today.
God doesn't need to wait for humans to decide to control the course of history. God doesn't need to eliminate human free will to control the course of history.
God can both carve out space for human free will and control the course of history. These are not logically inconsistent options.
[1] See Alvin Plantinga, God, Freedom, and Evil, Kindle ed (Grand Rapids: Eerdmans, 1989) for a complete accounting of this argument.