Answer
The Gentiles are “under Law”.
“But before the coming of faith, we (the Galatian Gentiles) were
guarded under Law, having been locked up” (Gal 3:23).
Explanation
“For sin was in the world until Law” (Rom 5:13).
This is a riddle. Scripture says sin was in the world until the Law was given publicly in writing.
But what is sin?
Sin is defined by Law.
“Everyone who sins breaks God's law, because sin is a breaking of
the law” (1 John 3:4; CEV, GNB).
Paul agrees with John (all the Apostles agreed on all things; they were “of one mind” – Acts 15:25):
“But I did not know sin except through Law; for also I did not
know lust except the Law said, "You shall not lust." (Rom 7:7).
So Apostles John and Paul tell us the same thing: sin is the transgression of God’s spiritual Law summarized in the Ten Commandments (You shall not lust is the 10th commandment).
So, now, the riddle is solved finally.
Sin, which is a breaking of the Law, was in the world from the beginning. But if the Law, which defined sin, was not in the world, how can sin be in the world?
Thus, it becomes clear that the Law and sin were very much active in the world though men didn’t realize it.
The crux of the riddle is this: before choosing Israel to be His nation, God dealt “individually” with the Patriarchs. He gave His spiritual Law to them directly. That is why God testifies that:
“Abraham obeyed My voice and kept My charge, My commandments, My
statutes, and My Laws” (Gen 26:5).
Another example is Patriarch Joseph. When his master Potiphar’s wife approached him, Joseph refused saying that he could not “sin against God” (Gen 39:9).
(Without realizing, Potiphar’s wife “lusted” after Joseph thus breaking the Law. But she didn’t know it).
It is significant that Joseph didn’t say ‘sin against Potiphar’, but sin against God.
Now the question is: how did Joseph know that adultery is a sin against God? So it shows clearly that he knew the Ten Commandments!
An Analogy
I believe it is God who is behind the great advancement in science and technology in the last two centuries (of course, through trial and error method) just as He prophesied through Daniel in 12:4. Let us take the case of the Law of Gravity discovered by Sir Isaac Newton. He is the first one to announce it to the public in writing. Now that does not mean that the Law of Gravity came into existence precisely at that time.
Law of Gravity was there in the world long before Newton. But people didn’t know or realize it. People who didn’t obey it broke their bones. Their lack of knowledge about the Law of Gravity does not absolve them from the consequences of breaking that Law.
Conclusion 1
God’s Law was active in the world. People didn’t realize it. It was publicly announced and made in writing by Moses later.
This means, sin was in the world with consequences. All sinned and were “under sin” and hence “under (the custody of) Law” (Gal 3:23; Rom 6:14).
When we combine Gal 3:23 and Rom 6:14 logically, we see that the Gentiles were "under sin" and hence under the custody of ("guarded under") Law before Jesus Christ came to redeem humanity.
In fact, Jesus had to come because men were under the custody of/ guarded under Law. Scripture is very clear but our 'a priori' interpretations confuse us.
Which Law in Galatians 4:5
The Scripture is very clear: the Ten Commandments are NOT Moses’ law. They are God’s Law, given directly to the children of Israel in great thunder and lightning (Exo 20:18). They were NOT written by Moses. In fact, the only thing that is written by God’s hand in the entire Scripture is the Ten Commandments:
“And when He finished speaking with him on Mount Sinai, He gave to
Moses the two tablets of the testimony, tablets of stone, written by
the finger of God” (Exo 31:18).
“and Jehovah gave to me the two tablets of stone written with the
finger of God, and on them was written according to all the Words
which Jehovah spoke with you in the mountain, out of the midst of the
fire” (Deut 9:10).
What is the most significant point to note here is that strangely Moses added, immediately after the Ten Commandments, these words:
“And He added no more” (Deut 5:22)!
The Ten Commandments that came directly from the great God was perfect!
No wonder, James says:
“But the one looking into the perfect Law of liberty” (James
1:25).
James meant the Ten Commandments by the perfect Law (James 2:11).
David agrees:
“The Law of Jehovah is perfect” (Psalms 19:7).
James calls them the “royal Law” (James 2:8) and a “Law of freedom” (verse 12). Paul calls them “Law of righteousness (dikaiosunei)” (Rom 9:31). He says the Law is “spiritual” (Rom 7:14), “holy”, “righteous” (dikaios), and “good” (verse 12). He also says “that the righteous (dikaioma) demand of the Law” must be “fulfilled in” those who walk according to Spirit and not according to flesh (Rom 8:4).
Sin is a spiritual issue because sin is defined by the spiritual Law of Ten Commandments (Rom 7:7).
So, Scripture says when one is “locked up under sin”, one is “under the (spiritual) Law shut up” (Gal 3:22-23; DRB).
One can be “under Law” only when “sin will have lordship over” one (Rom 6:14).
Thus it becomes clear: a sinner is under the custody of Law; he is locked up under Law; he is under arrest; he is held in remand; he is held a prisoner by the Spiritual Law; he is in jail (figuratively).
Conclusion 2
“Under Law” does not mean under the obligation to keep the spiritual Law.
“Under Law” means to be locked up or held under the custody or arrest of the spiritual Law.
So, when Galatians 4:5 says “to redeem those under the Law”, the Law, here, means the “royal”, “holy”, “righteous”, “good”, “perfect” and “spiritual” laws summarized in the Ten Commandments.
And the Galatian Gentiles were locked up under the spiritual Law.