We believe you are referring to Deuteronomy 23:2. “No one born of a forbidden marriage nor any of his descendants may enter the assembly of the LORD, even down to the tenth generation.”
The phrase “the assembly of the LORD” refers to civil leadership in Israel. It has nothing to do with going to heaven. “Born of a forbidden marriage” or, as some translations read, “of illegitimate birth” is difficult to define. Some Jewish writers define the phrase as someone who was born of an incestuous relationship between Jews, while others say it refers to those born of mixed marriages between the people of Israel and their pagan neighbors. (See Nehemiah 13:23.) “Even down to the tenth generation” illustrates just how serious it was to violate one of God’s Laws. Deuteronomy 23:2, as well as its preceding and subsequent scriptures are part of the Mosaic Law, which the Hebrews were required to keep so that they would not become contaminated by the practices of the pagan peoples surrounding them.
The Jews were God’s special people, from which Messiah was to come. The Law acted as a schoolmaster in order to bring the Jews to Christ. “So the law was put in charge to lead us to Christ that we might be justified by faith. Now that faith has come, we are no longer under the supervision of the law.” (Galatians 3:24-25) Once Jesus came and fulfilled the Law by his sacrifice unto death, the Law was no longer binding to the Jew providing he accepted Jesus. The Apostle Paul further explains this thought by commenting, “that a man is not justified by observing the law, but by faith in Jesus Christ.” (Galatians 2:15)
Deuteronomy 23:2 has no bearing whatsoever on whether a child born out of wedlock would qualify for entrance into heaven, since heaven was not even offered to the Jews at that time. It would be many years before Jesus would come on the scene, nail the Law to the Cross and offer us a new and living way by which we would be able to obtain a heavenly reward. Whether a child is legitimate or illegitimate is not the issue. Whether that child will grow up and lead a sacrificial life that is righteous and God honoring is the issue and will be the determinant that qualifies him for a heavenly resurrection.