The Old Testament depicts God as unfair and quite harsh sometimes. For example, why did the Egyptian population have to suffer and lose their first-born children just because of Pharaoh's stubbornness?
Pharaoh was an incredibly stubborn and wicked man. He had exhausted opportunity after opportunity to end his brutal exploitation of God's people. The death of the Egyptians' firstborn was the Tenth Plague of a series of plagues. Regardless of this overwhelming experience, the Egyptians still continued to harass and threaten the children of Israel. You can liken God's patience with Pharaoh to a parent administering discipline to their children by giving them a chance through "time-out" for a few moments or counting 1-2-3, and the children have the understanding that a swifter and stricter punishment can result after this grace period.
"For the horses of Pharaoh went with his chariots and his horsemen into the sea, and the Lord brought back the waters of the sea upon them. But the children of Israel went on dry land in the midst of the sea" (Exodus 15:19).
Despite the cruelty of the Egyptians, our Lord blessed the land of Egypt with a personal visit. "In that day there will be an altar to the Lord in the midst of the land of Egypt, and a pillar to the Lord at its border" (Isaiah 19:19). "And the Lord will strike Egypt, He will strike and heal it; they will return to the Lord, and He will be entreated by them and heal them" (Isaiah 19:22). "In that day Israel will be one of the three with Egypt and Assyria — a blessing in the midst of the land, whom the Lord of hosts shall bless, saying, 'Blessed is Egypt My people, and Assyria the work of My hands, and Israel My inheritance'" (Isaiah 19:24,25).