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."
*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