Peter Pett's Commentary on the Bible
Joshua 23 - Introduction
Chapter 23 Joshua's Speech to the Nation.
Joshua grew old and, possibly at the central sanctuary when Israel gathered together, or at Shechem, called the people together to give an address to the nation. He did not know how long he had to go and he wanted to pass on his final words in case he died before the next gathering. No doubt as he grew older he gave many such addresses. This was one selected to give the gist of what he said in them.
In his address to them he observed what God had done for them, and would do, and exhorted them to keep the commandments of God, and cleave to Him, and not to mix with the Canaanites, and join with them in their idolatrous practises. Then, he said, it would be well with them. But should they join with the Canaanites, and depart from YHWH, Who had so faithfully and in such a timely way performed every good thing He had promised them, they might expect many evils and calamities, and utter ruin and destruction, to fall on them.