These verses say that the work of the Law (the 10 commandments) is written on the hearts of the nations. Even though they don't have the 10 commandments, they still know that it's wrong to kill, steal, and commit adultery. They still know that they ought to worship God. They have a conscience.
They are not condemned because they violated the Law given to Israel. They are condemned because they've violated their own consciences and the work of the law which is written on their hearts.
"The works of the law" entailed a whole lot more than 10 commandments. It included annual sacrifices in Jerusalem, Holy Days, and much more.
The 10 commandment law was just an introductory course to law given by God to Moses on the Mountain. "The law" incorporated myriads of instructions and rules over and beyond the commandment stones.
Following is an example of how the New Testament writers, by inspiration of the Holy Spirit, understood what constituted "The Law" of the old testament:
Luke 2:23 As
it is written in the law of the Lord, Every male that openeth the womb shall be called holy to the Lord;
Exod 13:2 Sanctify unto me all the firstborn, whatsoever openeth the womb among the children of Israel, both of man and of beast: it is mine.
-----------------------------------------------------------
John 8:17
It is also written in your law, that the testimony of two men is true.
Deut 19:15 One witness shall not rise up against a man for any iniquity, or for any sin, in any sin that he sinneth: at the mouth of two witnesses, or at the mouth of three witnesses, shall the matter be established.
-----------------------------------------------------------
John 10:34 Jesus answered them,
Is it not written in your law, I said, Ye are gods?
Psa 82:6 I have said, Ye are gods; and all of you are children of the most High.
----------------------------------------------------------
John 12:34 The people answered him,
We have heard out of the law that Christ abideth for ever: and how sayest thou, The Son of man must be lifted up? who is this Son of man?
Psa 89:4 Thy seed will I establish for ever, and build up thy throne to all generations. Selah.
Psa 89:29 His seed also will I make to endure for ever, and his throne as the days of heaven.
Psa 89:36-37 His seed shall endure for ever, and his throne as the sun before me 37 It shall be established for ever as the moon, and as a faithful witness in heaven. Selah.
Psa 110:4 The LORD hath sworn, and will not repent, Thou art a priest for ever after the order of Melchizedek.
Isa 9:7 Of the increase of his government and peace there shall be no end, upon the throne of David, and upon his kingdom, to order it, and to establish it with judgment and with justice from henceforth even for ever. The zeal of the LORD of hosts will perform this.
Ezek 37:25 And they shall dwell in the land that I have given unto Jacob my servant, wherein your fathers have dwelt; and they shall dwell therein, even they, and their children, and their children's children for ever: and my servant David shall be their prince for ever.
------------------------------------------------------------------
John 15:25 But this cometh to pass, that
the word might be fulfilled that is written in their law, They hated me without a cause.
Psa 35:19; Let not them that are mine enemies wrongfully rejoice over me: neither let them wink with the eye that hate me without a cause.
Psa 69:4 They that hate me without a cause are more than the hairs of mine head: they that would destroy me, being mine enemies wrongfully, are mighty: then I restored that which I took not away.
------------------------------------------------------------------
1 Cor 9:9 For
it is written in the law of Moses, Thou shalt not muzzle the mouth of the ox that treadeth out the corn. Doth God take care for oxen?
Deut 25:4 Thou shalt not muzzle the ox when he treadeth out the corn.
----------------------------------------------------------------
1 Cor 14:21
In the law it is written, With men of other tongues and other lips will I speak unto this people; and yet for all that will they not hear me, saith the Lord.
Isa 28:11,12 For with stammering lips and another tongue will he speak to this people. 12 To whom he said, This is the rest wherewith ye may cause the weary to rest; and this is the refreshing: yet they would not hear.
----------------------------------------------------------------
Gal 3:10 For as many as are of the works of the law are under the curse: for it is written, Cursed is every one that continueth not in
all things which are written in the book of the law to do them.
Deut 27:26 Cursed be he that confirmeth not all the words of this law to do them. And all the people shall say, Amen.
-----------------------------------------------------------------
Gal 3:13 Christ hath redeemed us from
the curse of the law, being made a curse for us: for it is written, Cursed is every one that hangeth on a tree:
Deut 21:23 23 His body shall not remain all night upon the tree, but thou shalt in any wise bury him that day; for he that is hanged is accursed of God; that thy land be not defiled, which the LORD thy God giveth thee for an inheritance.