I was asked this question recently: Why do we pray when God is all-knowing? This is an important question. It's a question that has troubled even some theologians. A similar question is, if God always does his will, why on earth do we bother praying then?
One of the most helpful set of verses to answer these two related questions is actually the Lord's prayer. Matthew 6:9-13 says:
Our Father in heaven,
hallowed be your name.
Your kingdom come,
your will be done,
on earth as it is in heaven.
Give us this day our daily bread,
and forgive us our debts,
as we also have forgiven our debtors.
And lead us not into temptation,
but deliver us from evil.
There are many things we can learn about God from this prayer that Jesus taught but I want to highlight three points.
First, God is acknowledged as the one having authority (Our Father in heaven). We appeal to the highest authority when we pray.
Second, God has already established his good and perfect will. Jesus doesn't say to pray, "Your will be formed" or "Your will be suggested to us." Jesus told us to pray that God will fulfill the plans that he made. God has a plan that predates our prayer.
Third, there is the acknowledgement that we depend on God daily. This is shown to our appeal for our daily food. It highlights that it is God who takes care of our basic daily needs.
In other words, God is the highest authority who has already ordained that his will be done and that all creatures depend upon him for their lives.
Now if God has a will and he will do it without failure or defeat, then why on earth do we pray? Can we expect to change his mind? Can we—through prayer—bend his will so that we can get what we want?
One passage in the BIble that seems to indicate that we can change God's mind through prayer is when Moses beseeches God to change his mind about destroying the nation of Israel. In Exodus 32, God is angry with the Israelites for turning away from him, despite all the trouble he went through to rescue them from the hand of Pharoah. God says he wants to destroy them and begin afresh but Moses pleads with him not to and so God "changes" his mind and spares the people instead. On the surface, it seems that Moses did succeed in changing God's mind. But in fact, it is not. God already knew that the people would do this and he knew what he was going to do next. What God was doing was simply to involve Moses in the fulfilling of his will. For here, (and in other "change of mind" passages) God deliberately tells his servant of his threatened action, and by so doing, God is inviting the servant to plead for mercy. God could have just brought judgment to wicked sinful Israel without consulting Moses beforehand, but he did tell Moses to elicit the plea of mercy from him. Then God proceeds to carry out the mercy as he originally intended, now in response to Moses' prayer. Thus all Moses can do is praise God for his action. Prayer then, is a mechanism that allows us to participate in the unfolding of God's perfect will.
So how do our prayers make a difference? In his kindness, God has elected on occasion, that his good and perfect will be accomplished only as his people pray to ask God to work in a certain way. He knows what he wants to do but waits till his servants pray for it. The role of the prayer then, becomes necessary to the accomplishing of God's will. He can do it without our involvement or knowledge. But he chooses to include us so that we become part of what he is doing. God is sharing bountifully with those whom he loves. He lets us share in the anticipation and the joy that comes from seeing his will done. When we pray and our prayers are answered, we are overjoyed, God is glorified, and we understand better just what God had planned all along.
The fact that God is all-knowing is a great comfort to us when we pray. It means that God can anticipate and know the future and provide an answer for us accordingly. Matt 6:25–33 shows how God's all-knowing nature is a great comfort in prayer. For example, even before we pray for what we need, God knows what we need and he can therefore provide us what we are going to pray for. Frigthening is the notion that God isn't all-knowing and so may not know how best to answer a prayer. In such a scenario, how can he be equipped to pour out miracles "on the fly" if he can't anticipate what his people will pray for? Or how can he his will be done if he doesn't know what's coming up ahead?
I remember reading about George Müller, who was a famous evangelist with a great heart for children. He set up many homes for orphans but refused to seek donations to help run these orphanages. Instead, he prayed and ask God for all the provisions that the children needed. Often, at the breakfast table, the children would sit before empty plates and cups and George would lead in prayer, asking and thanking God for the food. When he finished praying, there would be a knock on the door. It would be a baker or milkman or someone else that God had impressed upon to donate provisions. So God knew what George Müller and the children needed. He sent the milkman and baker ahead, even before George prayed. Only an all-knowing God could answer George's prayer in such a timely manner. Indeed, for George, he got the help and God got the glory.
(For more on this, read Their God is too Small by Bruce A. Ware.)

