That God knows the future is a proposition with widespread support in the Scriptures. This means that God created Adam and Eve while knowing not only that they would eat of the forbidden fruit but also knowing the devastating effects of their action toward countless generations that came after them.
In answer to the question of why, perhaps the closest biblical answer is that such a situation was exactly what God wanted in order to demonstrate the riches of a grace that has been so lavished upon us. In becoming one of the least of us, to be born beside farm animals, and to walk the path that ultimately led to Calvary to be nailed to a cross, God revealed to mankind on earth and to the angels in heaven what kind of God He really was. For all of eternity the Second Person of the Trinity will exhibit the marks of His everlasting love. God deemed the tragedy of the Fall as being worthy of the opportunity to display the glories of the cross.
As to your question concerning prayer, some have responded that we ought to pray because the Bible commands it, that we should because Jesus did, or that when we do there is a peace that wells up within us. All of these answers are good, but I’d like to add one more. Are we so absolutely sure that the future is predetermined by God in such a way that our prayers will not make a significant difference? What if it is the case that we do not receive because we have not asked? (James 4:2). Hezekiah prayed and was given an extra fifteen years of life (2 Kings 20). What if he had not prayed? Would the results have been the same? Now think of the unimaginable possibility that one of your beloved ones was suddenly diagnosed with a terminal illness. Would all of the theological perplexities concerning prayer make a difference when something that close to our heart strikes us? Or do we cry out to God, not wanting to take the slightest chance that my lack of prayer may somehow contribute to their lack of healing? In other words, the intensity of my love for a child or a spouse or parent should overwhelm all perceived theological obstacles to prayer. I pray, even when I do not understand the mysteries of prayer, because He is able and I am not.