The LORD knew that they would do that because He exists in the ever present "now". The following explains what that means:
"Much of the difficulty in regard to the doctrine of Predestination is due to the finite character of our mind, which can grasp only a few details at a time, and which understands only a part of the relations between these. We are creatures of time, and often fail to take into consideration the fact that God is not limited as we are. That which appears to us as 'past,' 'present,' and 'future,' is all 'present' to His mind. It is an eternal 'now'...Just as He sees at one glance a road leading from New York to San Francisco, while we see only a small portion of it as we pass over it, so He sees all events in history, past, present, and future at one glance" (Loraine Boettner, The Reformed Doctrine of Predestination [Michigan: Wm. B. Eerdmans Publishing Company, 1932]).
In reality the LORD sees everything at one glance. Since there is no before or after with Him the verses which speak of His "foreknowledge" are not to be taken literally.