Paul says the same thing in his letter to the Ephesians:
Having abolished in his flesh the enmity, even the law of commandments contained in ordinances; for to make in himself of twain one new man, so making peace;
Ephesians 2:15
Paul’s not talking about the Ten Commandments here, he’s talking about the Mosaic Law. Just 4 chapters after talking about abolishing the Mosaic ordinances, he tells us to keep one of the Ten Commandments (the 5th one – Honor thy Father and Mother):
Children, obey your parents in the Lord: for this is right.
Ephesians 6:1,2
Honour thy father and mother; (which is the first commandment with promise)
Paul’s not contradicting himself here, he’s talking about the Book of the Law (written by Moses) in chapter 2, and God’s Law (the Ten Commandments) in chapter 6.
for not the hearers of the law are just before God, but the doers of the law shall be justified:
Romans 2:13
Circumcision is nothing, and uncircumcision is nothing, but the keeping of the commandments of God.
1 Corinthians 7:19
Is Paul contradicting himself again with these verses? Of course not. In the two verses above, he’s talking about the Law of God – the Ten Commandments. There are many more examples in the Bible showing the Ten Commandments are still valid and we are to keep them. Not to BE saved but because we ARE saved.
Most of us are Gentile believers. We do not need to follow the Law of Moses:
And they are informed of thee, that thou teachest all the Jews which are among the Gentiles to forsake Moses, saying that they ought not to circumcise their children, neither to walk after the customs.
As touching the Gentiles which believe, we have written and concluded that they observe no such thing, save only that they keep themselves from things offered to idols, and from blood, and from strangled, and from fornication.
Acts 21:21,25
For more see the separate God’s Law section.