Alec Motyer wrote this very helpful paragraph in his commentary on Exodus.
“When the Lord promised the land of Canaan to Abram and his descendants (Gen 15:7), every part of it was already occupied by other peoples. It would not have been consistent with the righteousness of God if he had simply taken this land from its rightful inhabitants and given it to someone else. We read, therefore, that the Lord proposed to give the Canaanite nations a four-hundred-year probation period, and only if they failed that probation would their land pas out of their possession (Gen 15:16). In the fulness of time the ousting of the Canaanites was accomplished by Joshua and his troops, and although we recoil, as surely we must, from the horrendous judgment then inflicted on the Canaanites (e.g. Josh 6:21), we must, nevertheless, be sure to see it in the light of its Genesis background and say that the Judge of all the earth has done right (Genesis 18:25). A genuine, even generous, probation had been allowed, but four hundred years saw only a steady decline into atrocious corruption, until the knife of the divine surgeon was the only recourse.” (Page 17)