Except for the Hivites living in Gibeon, not one city made a treaty of peace with the Israelites, who took them all in battle. For it was the Lord himself who hardened their hearts to wage war against Israel, so that he might destroy them totally, exterminating them without mercy, as the Lord had commanded Moses. Joshua 11:19-20
Some read these verses and wonder why God would harden their hearts and exterminate them without mercy. However, this needs to be understood in context. God did make provision for the Israelites to offer these cities a treaty of peace (Deuteronomy 20:10-11) but only the Gibeonites did. No other city attempted to save their citizens’ lives.
These people had seen clear evidence of God working on behalf of the Israelites. In the previous chapter, God sent hail (verse 11) and stopped the sun (verse 12). Baal was considered the weather god so God was telling them that he was more powerful than their gods. Yet they didn’t repent. Rahab had less evidence when she decided to trust the God of the Israelites (2:9-11).
God has set in motion a process whereby if people continually refuse to repent over time, their hearts become hard and unable to repent. So because these people didn’t take the opportunity God gave them, their hearts became hard.
In relating the story from a Jewish perspective the writer has no qualms about blaming God for their hardness of heart because after all, God created this process. Nevertheless from my Western perspective, I would say that God allowed their hearts to become hard because of the choices they made.
Today a person’s heart can still become hard if they don’t repent. Let’s be wise in the choices we make.