God has infinite power, he can put a male child in a virgin mother.
God does not decide how history goes, that is up to us.
Yes, he does know how everything will happen, but he did not decide for it to. All of the evil that we see in the world: the holocaust, the world wars, they happened from our actions, not God's.
There's also a verse in Genesis, "Male and Female, he created them." This verse means that if you're a male, you're a male, there's no changing that.