Why did God Ask Abraham To Sacrifice Isaac?

In Genesis 22, we're told that Abraham was commanded by God to take his second born son Isaac on a mountain that He would show him in order to have Isaac sacrificed to God as a burnt offering (verse 2). The very next day, Abraham took his son Isaac, and two of his servants with him. They loaded up the donkey. When he had cut enough wood for the burnt offering, he set out for the place God had told him about. (verse 3). It took them 3 days to get there (verse 4). He said to his servants, “Stay here with the donkey while I and the boy go over there. We will worship and then we will come back to you.” (verse 5). Isaac was naturally confused as to how exactly they would offer a sacrifice to the Lord God since they hadn't brought any lamb or goat with them to kill, but Abraham assured him that God would provide a sacrifice for them to slay (verses 6-8). Abraham proceeded to kill Isaac but God stopped him just in the nick of time. God said “Do not lay a hand on the boy. Do not do anything to him. Now I know that you fear God, because you have not withheld from me your son, your only son." (verse 12). But why did God do this? God obviously never intended for Abraham to actually sacrifice Isaac. He never wanted that to happen. This was a test of Abraham's faith. But does this really make sense in light of the biblical teaching that God is omniscient (meaning that He knows literally everything)? Moreover, isn't this a cruel thing to ask someone to do? Why would God ask a person to kill someone he loves so much? Does this passage of The Bible make God out to be evil and ignorant?

This is a good question. A while back I was reading a book I recommend on this topic. It is Paul Copan’s "Is God a Moral Monster?" In this book, Paul Copan addresses the accusations from the people like Richard Dawkins, Christopher Hitchens and others that the God of the Old Testament is evil. It seems on the surface of the issue that God was unreasonable and cruel to even ask Abraham to do such a thing in the first place. But then to go and say "Nah man, I was just kidding! I don't really want you to kill your son!". It appears as if God was playing a cruel joke on him. Never mind that it appears to make Him seem less the omniscient since He needed to test Abraham's loyalty, right? 

According to John Oakes from EvidenceForChristianity.org, "In the New Testament (and in the Old Testament) Abraham is the penultimate example of a person of faith. Romans chapter 4 describes Abraham, in his faith, as the father of all who are saved by faith. The testing of Abraham (and of Isaac as well, by the way) is a prophetic foreshadow of what God the Father asked God the Son–Jesus–to do. Abraham was asked to sacrifice his one and only son, just like God sacrificed his one and only son. The place of the sacrifice was Mount Moriah, which is most likely the exact same mountain where Jerusalem is built. The prophetic implication is great. Abraham received his son back from "the dead" on the third day. Isaac, like Jesus, carried the wood up Mt. Moriah which was to be used for the sacrifice. Was this an astounding request? Yes. Did it require an almost superhuman amount of faith for Abraham to complete the task? Yes. But that is the point. If you look at Hebrews 11:17-19 it offers a useful commentary on this test of Abraham. Here we see that Abraham reasoned in his mind that God could raise Isaac from the dead. Abraham’s faith was so great that he trusted God’s promise that a great nation would be built through Isaac, even in the face of what appears to be a terrible request. God honored the faith of Abraham. He provided a ram for the sacrifice. As promised, a great nation arose from the seed of Isaac, and in the end the Messiah came through that seed. What an awesome plan" 

In other words, One (though certainly not the only reason) God asked Abraham to do this was to create a typological story of God's salvation which would take place centuries later in the exact same spot. This way, after Jesus is crucified and risen from the dead, people can look back to the Old Testament scriptures and see how Jesus resembles the story of Abraham sacrificing Isaac. This would provide further verification of Jesus' messianic status. It would provide further evidence that Christ fulfilled the messianic prophesies. It would also be a great lesson for every generation who lived after Abraham. God keeps his promises. He rewards us when we have faith in Him and do what He tells us to do even if we don't understand it at the time. Even if what God is asking us sounds crazy. All generations after Abraham, reading his story, can look back and think "Even if what God is asking me to do sounds crazy, I must obey. God knows what he's doing. He will always do what is right. Good will come out of this." We are to be inspired by Abraham's great faith. His situation was a lesson to us. GotQuestions.org concurs. They write "When we obey as Abraham did, trusting that God’s plan is best, we exalt His attributes and praise Him. Abraham’s obedience in the face of this crushing command extolled God’s sovereign love, His trustworthiness, and His goodness, and it provided an example for us to follow. His faith in the God he had come to know and love placed Abraham in the pantheon of faithful heroes in Hebrews 11." 
Even though God knew in advance that Abraham would be faithful to him and would not disobey. Well, I guess if God doesn't have middle knowledge that wouldn't be the case (God doesn't know what anyone WOULD do on the Arminian's simple foreknowledge view). But even though God knew that Abraham would obey him even if He never gave him the command to sacrifice Isaac, our faith is proven by our works (see James 2:14-16). James says that faith without works is dead. While God can see our faith since He knows what's in our hearts (1 Samuel 16:7, Deuteronomy 31:21, Psalm 44:21, Psalm 139:2, Proverbs 15:11), men can only judge us by our actions (Matthew 7:16-19). See my article "Faith Or Works?" for more on this subject. My thinking is that God wanted Abraham and those around him, and those who would read about him to know how strong his faith in God was. Let me ask you, would you know how strong Abraham's faith was if he did not attempt to do what God told him to do? A propositional truth in God's middle knowledge would hardly be inspiring to believers today because we wouldn't know about it.
In conclusion, God was not cruel in asking Abraham to do what He did. I believe God had morally sufficient reasons for having Abraham go through that. It also does not imply that God is not omniscient.

BUT... what about God's statement in Genesis 22:12? "Do not do anything to him. Now I know that you fear God, because you have not withheld from me your son, your only son.” Wait, what? "Now I know that you fear God"? That seems to imply that He didn't know Abraham feared God before Abraham rose the knife preparing to impale his son with it. It seems like God was essentially going  "Aha! I was right! You DO fear me after all! I'm glad I found that out." I think Norman Geisler put it very well in his book "The Big Book Of Bible Difficulties". He said that The Bible as it is addressed to human beings, speaks from the human perspective. He said that God saying 'Now I know you fear God..." is like a math teacher saying "Let's see if we can find the square root of 49," and then, after demonstrating it, declare, "now we know that it is 7" even though she knew what what the answer was all along. 

*Was God Evil For Ordering The Destruction Of Nations In The Old Testamant?
*Problems With Denying Middle Knowledge. 
*Faith Or Works?
* Thou Shall Not Kill: Does God Violate His Own Commandment?
*The Doctrine Of Hell and Objections To It