John Frame (2013) discusses the forensic nature of justification in this way:
The language [for justification in the Westminster Larger Catechism] is forensic, that is, the language of a law court. In that court God is the Judge, and we are on trial for our sins – both the sin of Adam and the sins that we have committed in this life. The wages of sin is death, so clearly we deserve to die. But Jesus has taken that death penalty in our place. So the divine Judge turns to us and pronounces us not guilty. Indeed, he even goes beyond that, as a secular judge would never do, and says that we are positively righteous because of Christ. That is our justification.
It is important to distinguish between justification and sanctification, though Roman Catholic theology makes them overlap. In justification, God declares us righteous; in sanctification, he makes us righteous. Justification is forensic. It is about our legal status, not our inner character. For the important thing is that in justification God justifies theungodly, those who by their inner character are wicked. Contrary to Roman Catholicism, God does not justify us because he likes our inner character, even because he likes what he himself has done with us (our “infused” righteousness). He justifies us only because of Christ.
In Scripture, many passages indicate the forensic nature of justification. In Deuteronomy 25:1, judges in Israel are to justify the righteous and condemn the wicked. Clearly, this mean that judges are to declare the innocence of the righteous and the wickedness of the wicked. It cannot mean that judges are to make people righteous or wicked. In Luke 7:29, we read that some people “declared God just,” literally, “justified God” (as in the KJV), because of Jesus’ words. Clearly, that cannot mean that the people made God just. “Declared God just” is the correct translation.
In Romans 4:5, God “justifies the ungodly” apart from works. Since it is apart from works, justify cannot mean “to make righteous,” only “to declare righteous.” In Romans 8:33-34 and other passages, the word justify is the opposite of condemn. But condemn means “to declare someone guilty,” not “to make the person guilty.” Thus, it makes sense to take justify to mean “declare righteous.”
This is the consistent meaning of justify throughout Paul’s writings, when he is talking about the justification of sinners unto salvation (see Rom. 3:20, 26, 28; 5:1; 8:30; 10:4, 10; Gal. 2:15; 3:24) (pp. 966-967).
What then do we make of the relationship between sanctification and justification? Frame (2013) later notes that “justification, adoption, and subjective salvation are ‘inseparable.’ They are not synonymous, nor is one the ground of the other. But they are never found apart, and each proves the presence of the others. The point is this: that the redeemed man is justified, adopted, and sanctified” (p. 971).
Frame, J. M. (2013). Systematic theology: An introduction to Christian belief. Phillipsburg, New Jersey: P & R Publishing.