If you forsake the Lord, and serve strange gods
Joshua knew the proneness of this people to idolatry, and therefore expresses his jealousy of them, that they would not be able to continue in the service of God, and would be apt to be carried away after idols; and therefore, to make them the more cautious and watchful, he represents to them the danger they were in, and what would befall them should they forsake the Lord they now promised to serve, and follow after other gods, which their fathers worshipped before they were called out of their estate of Heathenism, or which the Canaanites, or Egyptians worshipped, whose examples they were too ready to imitate:
then he will turn and do you hurt;
not that there is properly any change in God, either of his counsel or covenant, or of love and affection to his people, but of his providential dealings, or outward manner of acting towards men; or the sense is, he will again do you hurt, bring evils and calamities upon you again and again, frequently as you revolt from him, such as the sword, pestilence, famine, and captivity, which these people after experienced when they fell into idolatry:
and consume you;
by these his sore judgments:
after that he hath done you good;
by bringing you into such a good land, and bestowing so many good things upon you, natural, civil, and religious; and yet, notwithstanding, being disobedient to him, and especially in the instances mentioned, they are made to expect his resentment, and the effects of it.