In Parshat Emor, the Torah states (22:32) that one must not desecrate God’s Name and that God will rest his Shechinah in Bnei Yisrael. In the next Pasuk, it says, “Hamotzei Etchem Meeretz Mitzrayim Lehiyot Lachem Lailokim, Ani Hashem,” “[I am] the one who took you out of Egypt to be your God; I am God.” But why does God say that He took Bnei Yisrael out of Egypt immediately after He discusses the Shechinah and desecration of His name?
Rashi answers that God took Bnei Yisrael out of Egypt on condition that they sanctify Him. Similarly, Ramban explains that because God redeemed Bnei Yisrael from Egypt, we are His slaves, and therefore must sanctify Him.
I would like to suggest another answer, similar to Rashi’s. The reason why we must worship God and perform His Mitzvot is that He took us out of Egypt. The Mitzvot are exclusively ours because they relate to the fact that God took us out of Egypt, and not because He created the world (a basis that would apply to all nations). Therefore, the first Dibra, about worshipping Hashem, identifies Him as the One who took us out of Mitzrayim. Similarly, Rav Chaim Soloveitchik says that the reason why the Rambam in Sefer Hamitzvot does not record Zechirat Yetziat Mitzrayim as a distinct Mitzvah is that it is included under the Mitzvah of Kriyat Shema. The theme of Kriyat Shema is accepting Hashem as our God: The first Parsha talks about Kabbalat Ol Malchut Shamayim, accepting Hashem’s commandments; the second Parsha relates to Kabbalat Ol Mitzvot, accepting the Kingship of God; and the third Parsha discusses Yetziat Mitzrayim. Thus, Kriyat Shema consists of a progression: We accept Hashem’s commandments because He is our King, and we accept Him as King because He took us out of Mitzrayim. As the three Parshiot of Shema demonstrate, we alone have this Mitzvah of accepting Hashem, because only we were taken out of Mitzrayim. Therefore, the Torah reminds us of this fact after discussing Hashem’s Shechinah and Name. If we keep this in mind while worshipping Hashem, it will allow us to love and fear Him, and to truly appreciate His Torah and Mitzvot.