The question is very logical 
but unfortunately based on the misconception. It is a commonplace misconception 
that everything is pre-determined. Had that been the case there would have been 
no need of creation which is subjected to retribution. God sure do know 
everything but has not pre-destined as perceived. There is a difference in His 
knowing everything and having pre-determined everything. He being the Creator 
does know how a person would lead his life, what choices would he make etc. He, 
nevertheless, has endowed man with free-will to exercise his right of choice 
from the options available. It, therefore, can not be imagined that He is going 
against his own words/promise. (God forbid)
The man operates under two different kinds of creational realms. 1) Takweeni—-where 
there is no choice. which applies to things such as death, age etc. 2) Tashri’i—- 
being a believer or nonbeliever, to be selfless or selfish etc, In-animated 
bodies such as trees, mountains, stars etc normally operating under the first 
rule of creation.
Similarly, there are two kinds of order/decree issued by God. 1) final 
decree---which does not admit any change. Like death or an affliction etc. 2) 
decre—which may or do admit a change—such as an affliction may be changed to 
health due to the prayers, or the intervention of the angels; appointed for the 
protection of human beings.
This is confirmed in Qura’an in surah Al Nahal 16, V 36. “And among them were 
those whom Allah guided, and among them were those upon whom error was 
[deservedly] decreed” & also V 37 “[Even] if you should strive for their 
guidance, [O Muhammad], indeed, Allah does not guide those He sends astray, and 
they will have no helpers” Hopefully this explanation would suffice for correct 
understanding. Thanks