Here, the Apostle raises the other question, namely, whether the Law is injurious to grace. First, he raises the question, saying, "Was the law then against the promises of God?" As if to say: If the Law was set because of transgressions, does the Law go counter to the promises of God, namely, so that what God promised He would do through the promised seed, He would do through another? "God forbid!" As if to say: No. For earlier he had said: "The law doth not disannul to make the promise of no effect" (3:17); "The law, indeed is holy and the commandment holy" (Rom 7:12).
Secondly, when he say...s, "For, if there had been a law given which could give life, verily justice should have been by the law," he answers the question.
First, he shows that the Law is not contrary to the promises of God;
Secondly, that the Law is in keeping with the promises (v. 22).
He says, therefore, that although the Law was set because of transgressions, nevertheless, it is not contrary to the promise of God in being unable to remove those transgressions. For if it were to remove them, then it would obviously be against the promises of God, because justice would be obtained by means other than God promised, since it would be through the Law and not through faith; whereas it is said: "The just shall live in his faith" (Hab. 2:4); "The justice of God is by faith of Jesus Christ" (Rom 3:22). Hence he says that "if there had been a law given such that it could" give life, i.e., of such power as to confer grace and eternal happiness, then verily and not seemingly, justice should have been by the law, if the Law were to effect what faith is said to effect. Thus faith would serve no end. But the Law does not give life, because "the letter of the law killeth," as is said in 2 Cor (3:6); "For the law of the spirit of life, in Christ Jesus, hath delivered me from the law of sin and of death" (Rom 8:2).
Source: Commentary on Galatians