After Avraham's mistake of asking "How will I know?" (Nedarim 32a - ושמואל אמר מפני שהפריז על מדותיו של הקב"ה שנאמר במה אדע כי אירשנה), his great grandchildren needed 400 years of slavery.
וַיֹּאמֶר לְאַבְרָם יָדֹעַ תֵּדַע כִּי־גֵר יִהְיֶה זַרְעֲךָ בְּאֶרֶץ לֹא לָהֶם וַעֲבָדוּם וְעִנּוּ אֹתָם אַרְבַּע מֵאוֹת שָׁנָה׃ (Bereishis 15:13) And He said to Abram, “Know well that your offspring shall be strangers in a land not theirs, and they shall be enslaved and oppressed four hundred years;
Although some suggest gematria explanations (see Daas Z'kenim: ד"א במ"ה עולה ארבע מאות בא"ת ב"ש), why was 400 years specifically helpful for remedying Avraham's error?