This is certainly a challenging question. I'll rely on the writings of two prominent reformed theologians, Louis Berkhof and Charles Hodge, who are strong supporters of this doctrine. It's important to note, for reasons that will become clear, that they defend their position in the face of arguments made by opponents who believe in a just God. Those who reject the existence of a just God due to the problem of evil, for example, are not in view.
Briefly, the arguments are 1) there are certain circumstances in which human judges can transfer criminal punishment, and those circumstances apply to Jesus, 2) the testimony of the Bible demonstrates that it is just, and 3) it is presumptuous to put one's own sense of justice over that of God's.
Human analogies
Berkhof begins his treatment by recognizing that "[t]here is undoubtedly a real difficulty here," particularly because the idea of a just God pouring out judgement on an innocent party rather than the guilty party "seems to be contrary to all human analogy." Along these lines Berkhof does suggest a few examples from the secular world, such as substitution in the case of mandatory military service.
Berkhof's main argument here, however, is that even in the case of criminal law, there are circumstances in which substitution is legitimate. He quotes Amour's Atonement and Law:
"[L]aw, as understood and administered by men in all lands, provides that the penalty may be met by a substitute, in all cases in which the penalty prescribed is such that a substitute may meet it consistently with the obligations he is already under."
Berkhof lays out some of the criteria under which a human judge might permit substitution: (1) the guilty party is not able to bear the punishment, (2) the substitution does not infringe on the rights of any innocent third parties, (3) the substitute is not already indebted to justice, and (4) the guilty party retains consciousness of guilt. Saying that "[i]t is perfectly evident that the law does recognize the principle of substitution," he admits difficulty but defends the position, saying,
In view of all this it will be understood that the transfer of penal debt is well-nigh, if not entirely, impossible among men. But in the case of Christ, which is altogether unique, because in it a situation obtained which has no parallel, all the conditions named were met. There was no injustice of any kind.
He continues:
[T]he fact that it is impossible to find men who meet these requirements, is no proof that Jesus Christ could not meet them. In fact, He could and did, and was therefore an acceptable substitute.
Testimony of the Bible
With respect to the Bible's teachings, Charles Hodge succinctly defends the doctrine from attack as follows:
If the Bible teaches that the innocent may bear the guilt of the actual transgressor; that He may endure the penalty incurred in his place, then it is in vain to say that this cannot be done.
This argument will fall flat to any who do not accept the Bible as divinely inspired, but Hodge's point is that the teachings of Scripture overwhelming support this doctrine, leaving "us no alternative but to receive them as the truths of God, or to reject the Bible as his word."
As a side note, some of the points along these lines are the expiatory and substitutionary nature of Old Testament sacrifices (Leviticus 1:4, 16:20-22, and 17:11), the teaching of our sins being laid upon Christ (Isaiah 53:6, 53:12; Galatians 3:13; Hebrews 9:28; 1 Peter 2:24), and that the prepositions used in these and other passage must mean "instead of," not "on behalf of," upon thorough evaluation of all uses of these words in the New Testament. (see Berkhof for more on this)
God is Justice
Addressing those who find the last argument unconvincing, Hodge calls on his opponents to consider:
Rejecting the Bible does not help the matter. We cannot reject the facts of providence. Where is the propriety of saying that the innocent cannot justly suffer for the guilty, when we see that they actually do thus suffer continually, and everywhere since the world began? [...] In teaching the doctrine of legal substitution, [...] the Bible asserts and assumes no moral principle which does not underlie all the providential dealings of God with individuals or with nations.
The point, Hodge says, is that men foolishly attempt to judge God for his supposed injustice, instead of recognizing that God defines what justice is. "Men," he says, "constantly deceive themselves by postulating as moral axioms what are nothing more than the forms in which their feelings or peculiar opinions find expression." If all these opinions are left unchecked,
[t]here would be no end of controversy, and no security for any truth whatever, if the strong personal convictions of individual minds be allowed to determine what is, or what is not true, what the Bible may, and what it may not, be allowed to teach.
He summarizes:
[T]here is nothing in the nature of things, nothing in the moral nature of man, nothing in the nature of God as revealed either in his providence or in his word, which forbids the idea that this obligation may on adequate grounds be transferred from one to another, or assumed by one in the place of others. (532)
Berkhof addresses these objections similarly, and also emphasizes that Christ's substitutionary work was voluntary, part of "a solemn agreement between the three persons in the Godhead." Furthermore, he argues that those who deny substitutionary atonement are forced to defend God's injustice for unnecessarily subjecting his Son to suffering and death.
Closing points
Obviously, as mentioned at the beginning, the arguments made by these two theologians will not be found particularly satisfactory to those who object to the existence of God based on the problem of evil. Without the common ground of belief in a just God who reveals himself in the Bible, arguments to defend the justice of penal substitution will be ignored for the same reason as arguments to defend God's justice in allowing pain and suffering in the world.
However, for those who believe that a just God exists, Berkhof and Hodge argue that human analogies for penal substitutionary atonement are available, that rejection of the doctrine requires rejection of the clear teaching of the Bible, and that our understanding of the nature of justice must be informed by God's revelation, not merely our intuitions.
References: