Reference to hardening of the heart recalls the plagues sent upon Egypt where God also hardened Pharaoh’s heart (Exodus 9:12; Exodus 10:1, Exodus 10:27; Exodus 11:10). In the events of the exodus, Pharaoh responded to the Israelite requests by hardening his own heart (Exodus 7:13–14, Exodus 7:22; Exodus 8:15), after which the Lord also hardened his heart. God hardened Pharaoh’s heart in order to demonstrate his power (Exodus 7:5, Exodus 7:17; Exodus 8:10, Exodus 8:22; Exodus 9:14, Exodus 9:16, Exodus 9:29; Exodus 10:2; Exodus 14:4, Exodus 14:18) over Egypt and their gods through the plagues.1
The hardening of the hearts of the Canaanites should probably be seen in a similar light. They heard about the victories of Israel (Joshua 2:9–11; Joshua 5:2; Joshua 9:1, Joshua 9:3; Joshua 10:1; Joshua 11:1), and decided to attack them. The Lord hardened their hearts, giving them over to their sinful desires rather than stopping them (see Romans 1:18–32), so that they would be destroyed and that all the peoples of the earth may know that the hand of the Lord is mighty (Joshua 4:24).2
20 For it was the LORD’s doing to harden their hearts that they should come against Israel in battle, in order that they should be devoted to destruction and should receive no mercy but be destroyed, just as the LORD commanded Moses.