The nation of Ammon was located north of Moab and east of the Jordan River. The Ammonites originated from Ben-Ammi, the son of an incestuous union of Lot with his younger daughter. Since Lot had been a member of Abraham's household as he entered the promised land, God had honored his promise to the patriarch in granting them protected status during the exodus. However, when the Ammonites treated their cousins badly, they were judged unworthy of citizenship among the people of Israel. In the Law of Moses, the Ammonites and the Moabites were excluded from the Israelite community "to the tenth generation."
Throughout their history the people of Ammon had an uneasy relationship with their distant cousins among the tribes of Israel. Consequently, there was constant fighting between Ammon and the tribes of Israel all during the days of the judges. In the course of these dark years, The Lord used Ammon to punish the compromise that had led the tribes to worship false gods such as Malcham (a.k.a. Molech) of Ammon. This included holding Israelites as slaves.
Famously, Jephthah, a man of low estate from nearby Gilead, was called on to lead the fight against the oppressor. When he successively led the troops against Ammon, his countrymen agreed to let him rule them. The Ammonites maintained an uneasy peace with the Israelites for generations to follow.
However, by the time of King Saul, the Ammonite King Nahash had begun to bully his neighbors in Jabesh of Gilead. The first king of the united kingdom of Israel successfully forced him to retreat back to his own borders. Bad feelings regarding this lingered into the day of King David, leading to a misunderstanding that led to war. It was during this war, the David's affair with Bathsheba, wife of Uriah occurred.
True to the command of the Lord, Israel never occupied the land of Ammon, but the nation was defeated by Israel two more times in later years. As with all its neighbors, Ammon paid tribute ("protection money") when the Assyrians, followed by the Babylonians, took over the area.