Well, if you look back in Deuteronomy chapter 20, the part where God orders the Israelites to commit genocide on the original inhabitants
20:16 But of the cities of these people, which the LORD thy God doth give thee for an inheritance, thou shalt save alive nothing that breatheth:
20:17 But thou shalt utterly destroy them; namely, the Hittites, and the Amorites, the Canaanites, and the Perizzites, the Hivites, and the Jebusites; as the LORD thy God hath commanded thee:
20:18 That they teach you not to do after all their abominations, which they have done unto their gods; so should ye sin against the LORD your God.
The Hebrews who returned to Israel from slavery under the pharoh were the decendents of those original inhabitants you refer to. Those original inhabitants (or rather their decendents) had fallen out of grace with God, resulting in His decree for the Hebrews to slay them