Bnei Yisrael were unprepared for their redemption from Egypt, and God places them in various situations of peril, encouraging Bnei Yisrael to raise their spiritual level high enough to enable that process to continue, and work toward real independence from their captors. 

Courtesy of the Virtual Beit Midrash, Yeshivat Har Etzion