The Catechism of the Catholic Church answers this question just as well as I could. See the following paragraphs from its treatment on the Fifth Commandment ("Thou shalt not kill"):
2265 Legitimate defense can be not only a right but a grave duty for one who is responsible for the lives of others. The defense of the common good requires that an unjust aggressor be rendered unable to cause harm. For this reason, those who legitimately hold authority also have the right to use arms to repel aggressors against the civil community entrusted to their responsibility.
2266 The efforts of the state to curb the spread of behavior harmful to people's rights and to the basic rules of civil society correspond to the requirement of safeguarding the common good. Legitimate public authority has the right and duty to inflict punishment proportionate to the gravity of the offense. Punishment has the primary aim of redressing the disorder introduced by the offense. When it is willingly accepted by the guilty party, it assumes the value of expiation. Punishment then, in addition to defending public order and protecting people's safety, has a medicinal purpose: as far as possible, it must contribute to the correction of the guilty party (cf. Lk 23:40-43).
2267 Assuming that the guilty party's identity and responsibility have been fully determined, the traditional teaching of the Church does not exclude recourse to the death penalty, if this is the only possible way of effectively defending human lives against the unjust aggressor.
If, however, non-lethal means are sufficient to defend and protect people's safety from the aggressor, authority will limit itself to such means, as these are more in keeping with the concrete conditions of the common good and more in conformity to the dignity of the human person.
Today, in fact, as a consequence of the possibilities which the state has for effectively preventing crime, by rendering one who has committed an offense incapable of doing harm - without definitely taking away from him the possibility of redeeming himself - the cases in which the execution of the offender is an absolute necessity "are very rare, if not practically nonexistent" (John Paul II, Evangelium vitae, no. 56).
What this means is that the death penalty is not always wrong. If the only way to protect communities is to take the life of the aggressor, then states have a right to do so.
The debate then centers around the question of when the death penalty is ever actually necessary. More and more it seems that we seek the death penalty out of revenge rather than from a real desire to protect society. The fact that many on death row are innocent also makes the death penalty a tragic and potentially unjust reality. But, it is also true that from time to time a criminal emerges who would remain a threat to the common good even from behind bars.
Since Catholics are allowed to disagree on the appropriate application of the death penalty, we should not demonize each other as we engage in this debate. Instead, we must follow our consciences and Church teaching.
Since today is "Respect Life Sunday", our thoughts and activism is naturally focused on the unborn, and rightly so. But, we might also say a prayer or offer up the Mass today for those who are on death row, for those who have incurred the death penalty, and for those judges and politicians who decide how it is implemented. We desire, as with any moral issue, that the dignity of the human person be always respected.