In order for the Israelites, with Joshua as their leader, to receive their inheritance in the land of Canaan they had to do two things. The first was to overcome certain nations already in or near the land of promise (Deuteronomy 7:1 - 2).
The second thing Israel had to do in Canaan was to learn to live with a few groups of people who were related to Israel in some way. Below are brief descriptions of the neighboring nations God commanded the Israelites not to bother or fight against.
The Ammonites, located east of Canaan on the other side of the Jordan River, are descended from Ben-ammi, who is Lot's son through his younger daughter (Genesis 19:36 - 38). Lot is the nephew of the patriarch Abraham. Many times they are mentioned with the Moabites, who are also descended from Lot but through his older daughter.
At one time the western boundary of the Ammonites ran all the way to the Jordan River and Dead Sea. By the time of Joshua, however, they had lost a substantial part of their land to the Ammorites (Numbers 21:21 - 25). God commanded the children of Israel, as they traveled toward their inheritance in Canaan, to avoid any conflict with the Ammonites as they passed near their land (Deuteronomy 2:19).
The chief god of the Ammonites was the pagan deity Molech, the worship of which required human sacrifices. Toward the end of King Jehoiakim's rule over Judah (598 B.C.) God sent a confederation made up of Ammonites, Moabites and others to punish the Jews for their sins.
In his days Nebuchadnezzar king of Babylon came up, and Jehoiakim became his servant three years. Then he turned and rebelled against him. And the Lord sent against him troops of the Chaldees, and bands of the Syrians, and troops of the Moabites, and troops of the Ammonites. And He sent them against Judah to destroy it . . . (2Kings 24:1 - 2, HBFV).
The Edomites, located to the south of Canaan, were the descendents of Esau, who was called Edom (which means 'red') due to being born with red hair (Genesis 25:21 - 25). He was the son of the patriarch Isaac and twin brother to Jacob (who God renamed Israel).
Esau, sometime after Jacob cheated him out of his birthright blessing (Genesis 27), migrated to the area outside of Canaan around Mt. Seir (Genesis 36:6 - 8). God gave this area to Esau to live in (Deuteronomy 2:5).
God commanded the Israelites, as they were approaching the borders of Edom on their way to Canaan, to not cause any trouble to their distant brother (Deuteronomy 2:1 - 8). The land of Edom was not to be part of Israel's inheritance from God.
The Moabites, like the Ammonites, are descendants of Lot. They are located to the south east of Canaan. Lot's drunken sex with his oldest daughter, after the destruction of Sodom and Gomorrah, produced a son named Moab (Genesis 19:23 - 25, 30 - 36). The children of Moab did not worship the true God. The god of the people was called Chemosh, a pagan deity that required human sacrifices.
And when the king of Moab saw that the battle was too strong for him, he took with him seven hundred men who drew swords in order to break through to the king of Edom, but they could not.
So he took his oldest son . . . and offered him for a burnt offering upon the wall . . . (2Kings 3:26 - 27, HBFV).
As the Israelites approached the land of Moab to the east of Canaan God told them to not fight with or cause trouble for the people. Israel, when the land would be divided under Joshua, was not to receive any part of the Moabite territory as an inheritance (Deuteronomy 2:9).