Deuteronomy 23:1 He that is wounded in the stones, or hath his privy member cut off, shall not enter into the congregation of the LORD. 2 A bastard shall not enter into the congregation of the LORD; even to his tenth generation shall he not enter into the congregation of the LORD. 3 An Ammonite or Moabite shall not enter into the congregation of the LORD; even to their tenth generation shall they not enter into the congregation of the LORD for ever: 4 Because they met you not with bread and with water in the way, when ye came forth out of Egypt; and because they hired against thee Balaam the son of Beor of Pethor of Mesopotamia, to curse thee. 5 Nevertheless the LORD thy God would not hearken unto Balaam; but the LORD thy God turned the curse into a blessing unto thee, because the LORD thy God loved thee. 6 Thou shalt not seek their peace nor their prosperity all thy days for ever. 7 Thou shalt not abhor an Edomite; for he is thy brother: thou shalt not abhor an Egyptian; because thou wast a stranger in his land. 8 The children that are begotten of them shall enter into the congregation of the LORD in their third generation.The eunuch, the illegitimate son, the Ammonite, Moabite and the Egyptian could live amongst the children of Israel but were classed as ceremonially unclean and therefore could not take part in the ceremonial observance of the Law, the sacrifices and the feasts etc.
They could still be devout and observe the Law have a genuine hope of salvation through the promises of God. Salvation comes not through the Law but by faith in God’s promises.
Isaiah 56:3 Neither let the son of the stranger (which includes the Ammonites, Moabites, Edomites and Egyptians), that hath joined himself to the LORD, speak, saying, The LORD hath utterly separated me from his people: neither let the eunuch say, Behold, I am a dry tree. 4 For thus saith the LORD unto the eunuchs that keep my sabbaths, and choose the things that please me, and take hold of my covenant; 5 Even unto them will I give in mine house and within my walls a place and a name better than of sons and of daughters: I will give them an everlasting name, that shall not be cut off. 6 Also the sons of the stranger, that join themselves to the LORD, to serve him, and to love the name of the LORD, to be his servants, every one that keepeth the sabbath from polluting it, and taketh hold of my covenant; 7 Even them will I bring to my holy mountain, and make them joyful in my house of prayer: their burnt offerings and their sacrifices shall be accepted upon mine altar; for mine house shall be called an house of prayer for all people. 8 The Lord GOD which gathereth the outcasts of Israel saith, Yet will I gather others to him, beside those that are gathered unto him.
In the ceremonial proscription (which was not the fault of the individuals themselves) we must seek for the spiritual lessons.
The eunuch could not beget children and was therefore unfruitful.
John 15:8 Herein is my Father glorified, that ye bear much fruit; so shall ye be my disciples.
2 Peter 1:8 For if these things be in you, and abound, they make you that ye shall neither be barren nor unfruitful in the knowledge of our Lord Jesus Christ.
The illegitimate son came of a union which was not permitted by the Law.
The spiritual lesson is that entry into the congregation must be in the way prescribed by God. We cannot choose our own way to approach God. This is demonstrated forcefully when Nadab and Abihu offered strange fire and God destroyed them (Leviticus 10:1,2).
John 14:6 Jesus saith unto him, I am the way, the truth, and the life: no man cometh unto the Father, but by me.
Acts 4:12 Neither is there salvation in any other: for there is none other name under heaven given among men, whereby we must be saved.
The Ammonite and Moabite were excluded from the congregation of the LORD to their tenth generation (or forever): Because they did not do the right thing when Israel came out of Egypt. Further, they contrived to get Israel cursed by Balaam.
Ammon and Moab were the children of Lot (Abraham’s Nephew) who owed their existence to the fact that God had saved him out of Sodom. God had instructed Israel not to molest them.
Deuteronomy 2:9 And the LORD said unto me, Distress not the Moabites, neither contend with them in battle: for I will not give thee of their land for a possession; because I have given Ar unto the children of Lot for a possession.... 19 And when thou comest nigh over against the children of Ammon, distress them not, nor meddle with them: for I will not give thee of the land of the children of Ammon any possession; because I have given it unto the children of Lot for a possession.
Taking this into account, we can see why their behaviour made their offspring ceremonially unclean.
Matthew 25:45 Then shall he answer them, saying, Verily I say unto you, Inasmuch as ye did it not to one of the least of these, ye did it not to me.
The Edomites and Egyptians came into a different category. Their offspring of the third generation are permitted to become proselytes and take part in the ceremonial observance of the Law.
Esau the father of Edom was Jacob (Israel)’s brother.
The Egyptians in the time of Joseph had welcomed Israel into their land and dealt well with them. In doing this they did that which was right in God’s sight at the beginning of Israel’s sojourn.
Exodus 23:9... thou shalt not oppress a stranger: for ye know the heart of a stranger, seeing ye were strangers in the land of Egypt.
The spiritual lesson is plain.
Matthew 25:35 For I was an hungred, and ye gave me meat: I was thirsty, and ye gave me drink: I was a stranger, and ye took me in
When a stranger entered into the congregation of Israel all his males were required to be circumcised.
Exodus 12:48 And when a stranger shall sojourn with thee, and will keep the passover to the LORD, let all his males be circumcised, and then let him come near and keep it; and he shall be as one that is born in the land: for no uncircumcised person shall eat thereof.
In the kingdom of God when the sanctuary is restored in Israel the spiritual teaching will be the same.
Ezekiel 44:9 Thus saith the Lord GOD; No stranger, uncircumcised in heart, nor uncircumcised in flesh, shall enter into my sanctuary, of any stranger that is among the children of Israel.
Again the spiritual lesson is plain.
Romans 2:29 But he is a Jew, which is one inwardly; and circumcision is that of the heart, in the spirit, and not in the letter; whose praise is not of men, but of God.
I hope you have found this helpful.