One justification for capital punishment comes from the Biblical admonishment not to murder (one of the Ten Commandments) and from God's instruction to Moses in Exodus 21:14: "But if a man willfully attacks another to kill him by cunning, you shall take him from my altar, that he may die."
Another justification comes from the renowned Biblical notion of "an eye for an eye," which in reality was a quote expressing the societal mores of the time. In most ancient societies, as well as modern ones, it has always been acceptable to put someone to death in retribution for first-degree (premeditated) murder. Applications of the death penalty for non-fatal crimes—say, for treason or embezzlement—are more controversial.
A third justification for the death penalty is more practical. Advocates say capital punishment deters others from committing crimes they know could result in execution. They also argue it's cheaper for society in the long run to execute prisoners than to confine them for life, paying for their food, shelter, and medical needs. Though these claims have been challenged by death-penalty opponents, I believe they are mostly accurate.
One major problem with the argument that capital punishment is an ineffective deterrent is that it's difficult to measure events that never happen. In other words, researchers really don't know how many times a criminal chose not to kill someone, or not to get involved with a crime that led to murder, because they were afraid of the consequences. Also, I realize that both keeping inmates imprisoned and the long process of court appeals before execution are expensive; it makes intuitive sense, though, that housing a murderer for life (say, on average, 40 years) and tending to medical needs as he or she ages, will ultimately cost more than a multi-year appeal process and the price of execution and burial.
As a case study, it is estimated that it cost California taxpayers more than $1 million—by some estimates more than $2 million—to house notorious murderer Charles Manson for 46 years before his death last year. Capital-punishment proponents claim it would have cost the state about half that much to execute him (California outlawed the death penalty shortly before Manson's 1971 conviction).