God doesn't make mistakes so if He knows what is going to happen it must happen.
It depends on what you mean by "must". Will it happen for a certainty? Absolutely YES. Does that mean it was caused by God to happen? Not necessarily. I say that because there are absolutely many things God has told us he has determined will happen, and they will happen.
But not all things are determined by God. God never determines that any man commit sin. God does not even tempt men to sin. Now, that said, it is obvious God allows sin to occur, that cannot be denied. Sometimes he allows sin to occur for a long period of time, and sometimes he kills a man or prevents sin the first time it occurs. That is all according to his best judgment.
God did not determine that Pharaoh would be rebellious. Rebellion is sin, so God would never tempt or cause Pharaoh to be obstinate and rebellious. But God in his foreknowledge knew that Pharaoh would be extremely stubborn and rebellious.
Exo 3:19 And I am sure that the king of Egypt will not let you go, no, not by a mighty hand.
20 And I will stretch out my hand, and smite Egypt with all my wonders which I will do in the midst thereof: and after that he will let you go.
Now, God did not determine verse 19. He did not determine that Pharaoh would be obstinate and rebellious, otherwise God contradicts his own word that he never tempts any man to sin.
But God did determine verse 20, he determined he would show great signs and wonders and these would influence Pharaoh to let the children of Israel go.
But God knew that Pharaoh would turn and become obstinate again, and his heart would become harder and harder against God.
And God knew Pharaoh would pursue Moses to destroy the children of Israel.
And so God was just to punish Pharaoh before the world and show his power.
But Pharaoh did not HAVE to be rebellious. God did not cause him to be rebellious.
Likewise, God did not cause the devil and the powers of darkness to crucify Jesus. In fact, we are told that if the princes of this world understood what God was doing, they would not have crucified Jesus.
1 Cor 2:8 Which none of the princes of this world knew: for had they known it,
they would not have crucified the Lord of glory.
God did not cause the devil and the princes of darkness to kill Jesus. This verse clearly shows they had choice. If they had understood how Jesus dying on the cross defeated the devil, they WOULD NOT HAVE crucified him.
Did God determine that Jesus would die on the cross for our sins? Absolutely, Jesus willingly allowed himself to be taken and crucified.
Did God determine that the Jews and Romans would kill Jesus? NO, God NEVER tempts any man to sin.
God can do all of this because he can foreknow what men will do before they actually do so. That does not mean he caused their actions.