But as the time of the promise drew near, which God had granted to Abraham, the people increased and multiplied in Egypt until there arose over Egypt another king who did not know Joseph.
Acts 7:17-18

God couldn't take Israel out of Egypt until the time was right. Oppression and enslavement wasn't the reason God rescued them. It was part of the process of preparing them for the rescue. We don't know that we need a redeemer until we feel the pain of oppression. God often uses slavery and suffering to teach us the value of liberty and joy.