Since God said "Do not murder", isn't the death penalty immoral?
The sixth commandment's prohibition against murder doesn't preclude taking any life under all circumstances. Murder means the unlawful taking of life. In the commandment against murder in Exodus 20, the Bible intentionally uses the Hebrew word ratzach, which means murder, rather than the Hebrew word for kill, harag. Therefore, the sixth commandment forbids unlawful killing, not all killing.
God granted mankind the right to take life as a penalty for murder or other serious crimes. God granted this right after the flood:
Gen. 9:5 “Surely I will require your lifeblood; from every beast I will require it. And from every man, from every man’s brother I will require the life of man.
Gen. 9:6 “Whoever sheds man’s blood,
By man his blood shall be shed,
For in the image of God
He made man.
Later, God incorporated the death penalty into His law given to Israel, and numerous crimes carried the death penalty. In the New Testament, Paul reminds the church that God instituted the death penalty for the good of all men to give mankind incentive to do right:
Rom. 13:1 Every person is to be in subjection to the governing authorities. For there is no authority except from God, and those which exist are established by God.
Rom. 13:2 Therefore whoever resists authority has opposed the ordinance of God; and they who have opposed will receive condemnation upon themselves.
Rom. 13:3 For rulers are not a cause of fear for good behavior, but for evil. Do you want to have no fear of authority? Do what is good and you will have praise from the same;
Rom. 13:4 for it is a minister of God to you for good. But if you do what is evil, be afraid; for it does not bear the sword for nothing; for it is a minister of God, an avenger who brings wrath on the one who practices evil.
Paul says that every person is expected to live in subjection to government because all governments trace their authority to God Himself. Human government will never be perfect, since all men are sinful. In fact, some governments are very corrupt and cruel, nevertheless we must respect these institutions simply because we trust the Lord’s choice to allow them and to work through them over time.
In general, when we respect government and obey it, we will see greater peace in our lives. Conversely, Paul says in v.2 that when we resist the authority of government, we bring condemnation upon ourselves. So when we do good, the government will (generally) praise us, and when we do evil, then we should expect the government to retaliate against us. This is God’s design to incentivize all men to do good.
In v.4 Paul says the government is a minister (i.e., servant) of God for the purpose of encouraging good. If a person chooses to do evil, such a person should be afraid, because the government doesn’t bear the sword for nothing. The phrase “bear the sword” was a Roman term meaning the right to condemn a criminal to execution.
In Romans 13 Paul is acknowledging that all government has a God-given right to “bear the sword” (i.e., to employ the death penalty) against those who commit evil. The government's right to take life for serious crimes is a minister of God, Paul says in v.4, acting as God’s personal avenger against those who commit evil.
While many governments today choose not to apply the death penalty, nevertheless the right to do so remains. Therefore, it is incorrect for any government or individual to declare that the death penalty is wrong or immoral. On the contrary, the Lord has granted human government the right to take life for the good of all society in controlling evil.
You also may find the related questions helpful.