564. Let Bygones Be Bygones: The prohibition against excluding Egyptians after two generations
…you shall not reject an Egyptian… (Deuteronomy 23:8)
Similar to the case of the Edomite convert in the previous mitzvah, an Egyptian convert was only to be excluded from the general marriage pool for two generations. The third generation was not to be excluded based on the Egyptian lineage. (Again, this would not obligate any one individual to marry the descendant of an Egyptian convert, it merely prohibits refusing them on the incorrect grounds that such a marriage is forbidden.)
As with the Edomite convert, the reason for this mitzvah is so that we should not assume that the indefinite ban on Ammonites and Moabites also applies to the Egyptians, who enslaved us. The stringency regarding Ammon and Moab only applies to those two nations, not to any other, regardless of any historical oppression we may have endured at their hands.
This mitzvah applies in all times and places. It is discussed in the Talmud in the tractates of Yevamos (75a-78b) and Kiddushin (75a) and is codified in the Shulchan Aruch in Even Ha’Ezer 4. This mitzvah is #55 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos; it is not listed in the Chofetz Chaim’s Sefer HaMitzvos HaKatzar.