The question often comes up - how could God condemn people to Hell for eternity if they never heard the gospel (either before Christ or after Christ)? This passage explains explicitly how it is God can be just in doing this. Aside from the obvious answer - God can do whatever He jolly well wants to do - it is still worth looking at how Paul acquits God of wrongdoing in such a case. First, it must be noted that the main point of this passage is: those with the law will be judged by it, and those without the law will perish without it. This is a passage of pronounced, unavoidable judgment according to the law. Why can't those who have the law be justified? According to 13b, they cannot be justified because merely having the law is not sufficient for salvation - acting in accordance with the law is the necessary requirement. While not explicitly stated in this passage, it is not a stretch to assume Paul has ethnic Jews in mind here given their mention before and after this passage. This is consequence the consequence for Jews: merely having the commandments and being ethnic descendants of Abraham are insufficient for justification. Circumcision is of some value, but is not the ultimate justifier. The natural question, then, is how can one who does not have the law have judgment pronounced upon them? After all, how can you not break rules you don't know exist? Isn't it a little hypocritical to condemn people for doing something they didn't know they weren't supposed to do? If that was the question, then yes - it would be hypocritical. That, however, is not the right question! The truth is, people did have the law! They may not have had the written commandments of Moses, but they had the commandments of God inscribed upon their hearts - and, despite their conscience bearing witness, they went contrary to what was right and have become so malformed their conscience will try to excuse their corrupt behavior when they stand before the judgment seat of Christ. They are a law unto themselves - their own hearts condemn them. The question, then, is this: is it hypocritical to condemn people for doing something they knew internally they weren't supposed to do? The answer is no - it isn't hypocritical to hold them to the standard of the law, when that standard was inscribed upon their hearts and they willfully ignored it. God is just, and Paul proves it here. People will indeed perish, but no innocent person (aside from Christ) will perish - all who perish are guilty.
For all who have sinned v without the law
will also perish without the law,
and all who have sinned under the law
will be judged by the law.
For w it is not the hearers of the law who are righteous before God,
but the doers of the law who will be justified.
For when Gentiles, who do not have the law, x by nature do what the law requires,
they are a law to themselves,
even though they do not have the law.
They show that the work of the law is y written on their hearts,
while their conscience also bears witness,
and their conflicting thoughts accuse
or even excuse them
z on that day when, a according to my gospel, God judges b the secrets of men c by Christ Jesus.