When Gentiles, who do not have the law, by nature do the things in the law, these, although not having the law, are a law to themselves.
What is the situation with the heathen who “do not have the law” of the Old Testament (nor possibly the gospel of Jesus Christ)? Let us note that Paul is not writing at this point on the subject of how the heathen can be saved. He is dealing with the objections of self-assured Jews who imagine they do not need the gospel because they have the law. The heathen who did not know the law would be judged in any case (cf. John 7:49). Paul had countered their claim, stating that not the hearers but the doers of the law are righteous before God.
Jews had to consider the possibility of a heathen’s life corresponding more to the demands of the law than their own, not because he knew the law, but doing so “by nature”. “By nature” does not mean that people are capable of doing the will of God in their own strength. But people who know neither the law nor the gospel can have a moral consciousness, a natural moral sensibility concerning good and evil, right and wrong.
If such individuals from among the heathen “by nature do the things of the law” they take the revelation of God in creation seriously. They reject the worship of idols. “You shall have no other gods before me” is the first commandment in the law (Exodus 20:3). They agree fully with God’s righteous verdict on immorality and conduct their life accordingly (cf. Romans 1:29-32).