Joshua 23:16
When ye have transgressed the covenant of the LORD your God, which he commanded you, and have gone and served other gods, and bowed yourselves to them; then shall the anger of the LORD be kindled against you, and ye shall perish quickly from off the good land which he hath given unto you.
The verse belongs to Joshua's final address to Israel after the Lord had given them rest from their enemies, an address in which he reviewed God's care for them. In that setting the warning was against idolatry and close ties with idolaters, including intermarriage, because such associations could corrupt Israel and lead them away from God. To transgress the covenant is to go and serve, worship, and bow down to other gods.
Such unfaithfulness would kindle the anger of the Lord against them and cause them to perish quickly from off the good land which He had given them. This threatened judgment is as certain as God's fulfilled promises, for just as every good thing He promised came to pass, so He will also carry out what He threatened and execute the threatened judgment. The warning applies to an individual as well, so that departing from God brings ruin.