|(Trees in my backyard)|
The plagues God sent upon Pharaoh and the Egyptians were not merely for punishment, but also for redemption. God was trying to save Pharaoh and the Egyptians.
On first glance, it doesn't appear that way, given Exodus 10:20, which reads, "the LORD hardened Pharaoh's heart." It appears Pharaoh didn't have a chance to repent.
But John Sanders points out that "the Hebrew word for "hardening" means "to strengthen," so hardening does not render a person unable to repent. This is easily seen by the fact that God hardens the hearts of Pharaoh's servants (Ex 10:1), yet they understand what God is doing and implore their master to release the Israelites (10:7)." (Sanders, What About Those Who Have Never Heard?: Three Views on the Destiny of the Unevangelized, Kindle Locations 239-240)
God uses conditional language with Pharaoh, which implies Pharaoh has a choice. For example, Exodus 8:2: "If you refuse to let them go, I will plague your whole country with frogs." The conditional word "if" makes no sense if Pharaoh was rendered incapable of making a choice.
For example, what if a professor had to power to harden your heart so you could not, and would not, complete your assignments. It would make no sense for the professor to say, "If you don't complete your assignments, you'll fail this course." It would make sense if you could choose to turn in your work.
"Evidently the divine strengthening of Pharaoh did not override Pharaoh's decision-making powers. The plagues were for redemptive and not merely retributive purposes. Truly God has never delighted in the death of the wicked. Punishment came to the Egyptians, but not before God did all he could to bring redemption into the situation." (Ib., Kindle Locations 241-243)