In his letter to the Galatians, Paul had entered into a discussion on the function, and the purpose of the law. Apparently some Jews had been teaching these Galatians that obedience to the Mosaic Law was necessary for salvation.
For Paul, this was spiritual suicide. He said in Galatians 3 that “all who rely on works of the law are under a curse”, because “cursed is everyone who does not abide by all things written in the law” (3:10). In other words, trying to be justified by the law is impossible, because the law demands perfect obedience (abiding by all things). And because all men are enslaved to sin, anyone trying to obey all things written in the law is attempting the impossible. They are committing themselves to a standard that they will never live up to, even fall constantly short of. Paul concludes by saying that “no one is justified before God by the law” (Gal 3:11).
Of course, a question naturally arises from this whole discussion: why did God give his law? If the law does not and cannot save anyone, then what is its purpose? Why would God give a standard impossible to meet? What was his purpose in giving it?
Paul takes up this question in the next section of Galatians 3. Paul himself asks, “why then the law?” (Gal 3:19). He answers by saying that the law “was added because of transgressions until the offspring should come to whom the promise had been made…” (Gal 3:19). Now, what does Paul mean by this? And in what way is the giving of the law connected to the coming of Christ (the offspring)?
James Boice answer this question, saying,
On the surface the [verse] is ambiguous. The phrase [“was added because of transgressions”] can mean either that the law was given to restrain transgressions (which is the natural function of law) or that the law was given to make the transgression known, even in one sense to encourage them or to provoke them to a new intensity. In view of Paul’s choice of word “transgressions” rather than “sin” in this context and of his discussion of the purpose of the law elsewhere, the latter is the only real possibility. In Romans, Paul argues that “through the law we become conscious of sin” (Rom 3:20) and that “where there is no law there is no transgression” (Rom 4:15). The point is that though sin was in the world before the giving of the law, sin was not always known as such. The law reveals sin as sin. Hence, it may be said that it is the law that turns sin into transgression — transgression of law — and even accentuates it (Rom 5:20). In this act, law performs the function of showing man’s need of a Savior.
In other words, the law makes us aware of our sin. Paul himself says in Romans 7:7, “if it had not been for the law, I would not have known sin. For I would not have known what it is to covet if the law had not said, ‘You shall not covet'”. The law functioned in making Paul aware of his covetousness. In this way, the purpose of the law is to make us aware of our own transgressing of God’s commands. And in making us aware of our transgressions, it makes us aware of our need for a Savior.
Phillip Ryken adds,
When [Galatians 3] says that the law was “added”, it literally says that the law came in by a side road. The law feeds into the promise [of the gospel]; it is the on-ramp to the gospel highway. [The reason for this is because] the more we know the law, the more we see our sin, and the more we see this, the more we confess that we need a Savior. “The law was given”, wrote Calvin, “in order to make transgressions obvious, and in this way to compel men to acknowledge their guilt”. And it is only when we see our guilt that we see how much we need Jesus. The law is the law so that Christ can become our Savior.
In this way, the law came alongside the promise of Christ. The law was never opposed to the promise of the gospel. Rather, the burden of the law serves to make sinners more and more aware of the exceeding sinfulness of their sin! And then, it leads sinners straight to the gospel, in which the whole curse of the law is lifted and placed on Christ.