The Torah in Parashat Ki-Teseh (Debarim 23:8-9) forbids “despising” or “rejecting” people from the nations of Edom and Egypt, and establishes that a third-generation Edomi or Misri (Egyptian) may marry into the Jewish Nation. Meaning, if a person from Edom or Egypt converts to Judaism, then the convert’s grandchild may marry a Jew. The Sefer Ha’hinuch lists as two separate Biblical commands the prohibition against refusing to allow the marriage of a third-generation Edomi, and refusing to allow the marriage of a third-generation Misri.
The Torah here draws a distinction between these two nations, whose members may marry a Jew after two generations, and the nations of Amon and Moab, whose male descendants for all time are barred from marrying into Beneh Yisrael. As discussed in regard to Misva 561 and Miva 562, the Torah forbids people from Amon and Moab from marrying into Beneh Yisrael because these nations showed ingratitude to Beneh Yisrael. They descended from Lot, who owed his life to Abraham Abinu, and yet, they did not come to assist Beneh Yisrael by offering them provisions as they traveled near their territory in the wilderness after the Exodus. For this ingratitude, descendants from Amon and Moab are forever barred from marrying into the Jewish Nation. By contrast, descendants of Edom and Egypt are allowed to marry a Jew after two generations.
The Sefer Ha’hinuch discusses the difference between these two pairs of nations. He writes that although the Egyptians bitterly oppressed Beneh Yisrael for many years, nevertheless, this period of oppression was in fulfilled of G-d’s decree. G-d had informed Abraham Abinu that his descendants would endure persecution in a foreign country (Bereshit 15:13), and this decree was fulfilled through the Egyptians’ enslavement of Beneh Yisrael. Of course, the Egyptians were held accountable for their cruelty, and punished accordingly, but, nevertheless, since their oppression of Beneh Yisrael fulfilled a divine decree, they are not barred from joining our nation. Amon and Moab, however, chose to show ingratitude, and so they are forever prohibited from joining Am Yisrael through marriage.
If a man and woman from Edom (or Egypt) married, and, after the wife conceived, they converted to Judaism, then the baby is considered a second-generation Edomi, such that his child may marry a Jew. Even though the baby underwent conversion in utero, nevertheless, he is treated as the child of an Edomi convert, and not as a convert himself.
If a male convert from Amon married a female convert from Edom (or Egypt), then their children are regarded as descendants of Amon, not as descendants of Moab. Therefore, their offspring may not marry into the Jewish Nation. Conversely, if a male convert from Edom (or Egypt) married a female convert from Amon, their children are regarded as Edomites (or Egyptians), and thus their offspring may marry into the Jewish Nation. With regard to gentiles, lineage is determined based on patrilineal descent, and thus the children have the status of the father. For Jews, as we know, children’s status is determined based on the mother’s status.
These commands apply in all places and all times. The Sefer Ha’hinuch writes that one violates these prohibitions by refusing to allow one’s child to marry a third-generation Edomi or Egyptian out of hatred for these nations. It goes without saying that if the match is rejected for some other reason, this does not violate the Biblical command. These prohibitions are transgressed only if one does not permit his child to marry a third-generation descendant of Edom or Egypt specifically out of animosity for these nations. Of course, one is not liable to Malkut for transgressing these prohibitions, as the violation is committed without performing an action.
The Sefer Ha’hinuch clarifies that there is certainly no Misva to marry descendants from Edom or Egypt. The Torah here only forbids rejecting them as marriage partners out of contempt for these nations.
As mentioned regarding previous Misvot, nowadays, we cannot identify the descendants of the ancient gentile nations. The Assyrian emperor Sanherib conquered much of the ancient world, and, whenever he conquered a country, he had its population exiled somewhere else, and brought a different nation’s population to that region. Therefore, the people living in Edom or Egypt after the Assyrian conquests are not necessarily from the ancient nations of Edom and Egypt. Any gentile who converts to Judaism may be presumed to be among the majority of gentiles, who may marry into the Jewish Nation after conversion, and is thus permitted to marry a Jew.

