It was foretold to Abraham in a dream that his descendants would serve as slaves in a foreign land for 400 yrs (or 4 generations of priests). Genesis 15:12-16
Yet the Bible also tells us that the Israelites lived in Egypt for 430 years to the very day. Exodus 12:40-41
The Israelite Oppression ended when the 12th dynasty ended, about 10 years after Moses / Amenemhet IV went into exile at the age of 40 years. This was 400 years after Jacob and his family came to Egypt. The Exodus did not take place until 30 years into the 13th dynasty when Moses / Amenemhet IV returned to confront Neferhotep I at the age of 80 years.
The Israelite oppression lasted 400 years – it ended when the 12th dynasty ended. No more pyramids were built after the 12th dynasty. The 13th dynasty was very chaotic and the Pharaohs did not focus on oppressing the Israelites because their thrones were not stable enough and maybe their attitude towards the Israelites was slightly more sympathetic than that of the 12th dynasty pharaohs. The Exodus occurred 30 years into the 13th dynasty during the reign of Neferhotep I who was the longest ruling pharaoh of that dynasty (11 years).
Amenemhet III would have reigned between 2-6 years after Moses fled to Midian and Sobekneferu would have reigned between 4-8 years after her father Amenemhet III and then she died. When she died, the 12th dynasty ended as there was no heir to the throne. The result was that Egypt fell into Chaos. There was a rapid succession of Pharaohs in the 13th dynasty and as a result, the Israelites were not oppressed during this time. They were able to keep multiplying and prepare to leave Egypt.
The Exodus occurred exactly 40 years after Moses fled to Midian and about 30 years after the 12th dynasty ended with the death of Sobeknefru.