There is a long-standing debate about free will and God's foreknowledge.
Intuitively, the two notions seem mutually exclusive, at least they did to me some twenty-five or more years ago when I first considered the matter and started contemplating it.
The whole issue was so bothersome to me --- becoming an issue of study, prayer, and serious contemplation --- that I did something unusual for me then or even for me now. I went to the University Library looking for something that would clarify the matter. I didn't know exactly what I was looking for, however, I knew that I wanted to find something that addressed the issue. But I also wanted something that had arisen within a context of my faith . In other words, I wanted someone with a similar background to mine to address the issue with a delicate, spiritual balance of faith and intellect. I wasn't that interested at that time in what philosophy professors might say about the subject. I wanted, if I could find it, an LDS point of view. I could deal later, I thought, with what philosophy professors and intellectuals said relative to the issue.
What I stumbled onto that day was an article by an individual I had never heard of before, Blake Ostler, an attorney who also dabbled in philosophy, but who was also a practicing, and as far as I could determine a faithful Mormon.
It was an article in a scholarly journal on Mormonism, one I had heard of before but had not ever seen or read: Dialogue, A Journal of Mormon Thought. The article was entitled "The Mormon Concept of God".
I read the article, took the journal to the copy machine and copied it, took it home and kept it, and subscribed to the journal, which subscription I have kept since that time. I even made a special purchase of the volume that the article contained, since my subscription was prospective and the volumes I would receive in the future after I took out my subscription would not include the volume with the subject article .
Most Mormons I know and those at the top of the heap of Mormons who control the church and lead it, believe God has infallible foreknowledge. Yet they also believe in free will, that is, that individuals have the right to choose without compunction. They believe the two notions --- God having infallible foreknowledge and individuals having free will --- are compatible.
They are want, however, as far as I have determined, to explain how that works. They just don't know; they just believe it's so without questioning it or having to explain it further. In fact, most of them think the exercise in doing so is a waste of time or believe that contemplating it and exploring it or expressing chagrin over their take of it is a manifestation of lack of faith, a contentious exercise.
Most of them believe that life isn't so much a test administered and graded by God for Him to see if we will do what is right or not, but rather is a test for ourselves to show how wonderfully magnificent or how totally awful we will do --- including, of course, every possible intermediary position. God doesn't need us to do it for Him; he already knows. God does it for us so that we gain insight into ourselves that he has and, apparently, always has had. (I can't imagine living without discovery and surprise; it seems like it would be so boring and unfulfilling.)
I suppose some of these members' concerns could have to do with the notion that if God is or can be surprised, he isn't really in total control and isn't, perhaps, the kind of God they want to worship or put their faith and trust in. Ironically, they will almost uniformly agree that God is bound by the very necessity of preserving free will, admitting that if God didn't permit free will to exist he would cease to be God. On the other hand, given their perception that God knows the future without flaw, there is no such thing as free will.
My dictionary defines free will as follows: The power, attributed especially to human beings, of making free choices that are unconstrained by external circumstances or by an agency such as fate or divine will.