These verses were revealed in Madinah (Mawdudi & Dr. Muhammad Asad).
The Holy Quran has prescribed death penalty for those who murder innocent people:
2:178 O you who have believed, prescribed for you is legal retribution for those murdered – the free for the free, the slave for the slave, and the female for the female. But whoever overlooks from his brother anything, then there should be a suitable follow-up and payment to him with good conduct. This is an alleviation from your Lord and a mercy. But whoever transgresses after that will have a painful punishment.
2:279 And there is for you in legal retribution [saving of] life, O you [people] of understanding, that you may become righteous.
The above verses were revealed at a time when Arabian culture was oft in blood spilling among different tribes. The verse was revealed concerning cultural tradition where the killer was never killed. Instead an innocent person was killed in place of the perpetrator.
For example, if a wealthy man, high ranking in a tribe murdered a person, he wouldn’t be killed for it, instead they would drag a poor innocent man to be killed, instead of the wealthy man, this was the culture of pre-Islam. Hence, the current verse was addressing this backward and barbaric culture by putting an end to this, by commanding that only the killer who committed the crime should be killed, not an innocent person.
Furthermore, it was up to the family’s victim if they wanted retribution i.e., for the killer to be killed or be forgiven. If the killer were to forgiven by the family of the victim, he had to pay blood money (diyah).
Maulana Mufti Muhammad Shafi:
“Under the first injunction in this connection, the verse prescribes the law of Qisas (even retaliation), that is, the killer will be killed, irrespective of the status of the parties involved. If the aggrieved party somewhat relents on its own and forgives the Qisas, but does not forgive the offence totally, it will become necessary for the killer to pay diyah (…) or blood-money as fixed, in a fair manner, and promptly.
The claimant too, should pursue the matter in a recognized manner causing no harassment to the defendant. This law of blood-money and pardon is a relief granted by Allah Almighty in His Grace, otherwise, there would have been no choice but to face the punishment of death. If, after all that, anyone crosses the limit set by Allah, such as, the filling of a false or doubtful case of murder, or a post-pardon re-opening of a murder case, he will be severely punished.
In the end, the verse points out that wise people should have no difficulty in seeing that the law of even retaliation does not take life, instead, it gives life, for such a deterrent law will make people fear the punishment of killing somebody and thus lives will be saved.
THERE IS LIFE IN ‘QISAS’
Literally, the word Qisas means likeness. In usage, it denotes ‘even retaliation’ or to return like for like. In Islamic juristic terminology, Qisas means the equal retaliation of an aggression commited against the body of a person. This retaliation is allowed only with condition that the principle of ‘like for like’ is strictly observed. This has been explained more clearly later on in verse 194 of this very surah which says:
So, aggress against him in the like manner as he did against you.
And also in the concluding verses of Surah al-Nahl, the same rule has been covered:
And, if you retaliate, then retaliate just as you have been oppressed against. (16:126)
Therefore, as a term of the Shari’ah, the Qisas is a punishment for killing or wounding in which the principle of equality or likeness is taken into full consideration.
1. The principle of even retaliation is applied exclusively in cases of culpable homicide when someone has been killed intentionally with a lethal weapon causing injury and blood-less.
2. In a homicide of this nature, the killer is killed in even retaliation – ‘free man for a free man, slave for a slave, and female for a female – and similarly, a man for a woman. The mention of ‘free man for a free man’ and ‘female for a female’ in this verse refers to a specific event in the background of which it was revealed. On the authority of Ibn Abi Hatim, Ibn Kathir has reported that, just before the advent of Islam, war broke out between two tribes. Many men and women, free and slaves, belonging to both, were killed.
Their case was still undecided when the Islamic period set in and the two tribes entered the fold of Islam. Now that they were Muslims, they started talking about retaliation for those killed on each side. One of the tribes which was more powerful insisted that they would not agree to anything less than that a free man for their slave and a man for their woman be killed from the other side.
It was to refute this barbaric demand on their part that this verse was revealed. By saying ‘free man for a free man, slave for a slave and female for a female’ it is intended to negate their absurd demand that a free man for a slave and man for a woman should be killed in retaliation, even though he may not be the killer.
The just Law that Islam enforced was that the killer is the one who has to be killed in Qisas. If a woman is the killer, why should an innocent man be killed in retaliation? Similarly, if the killer is a slave, there is no sense in retaliating against an innocent free man. This is an injustice which can never be tolerated in Islam.
This verse means nothing but what has been stated earlier, and we repeat, that the one who has killed will be the one to be killed in Qisas. It is not permissible to kill an innocent man or someone free for a killer, woman or slave. Let is hasten to clarify that the verse does not mean that Qisas will not be taken from a man who kills a woman or from a free man who kills a slave. In the very beginning of this verse the words …:
‘The Qisas has been enjoined upon you in that case of those murdered” are a clear proof of this universality of application. There are other verses where this aspect has been stated more explicitly, for instance, in … (the person for the person). …” 
Tafhim al-Qur’an – Sayyid Abul Ala Maududi:
“176 The Arabic word “visas” stands for the return of life for life in cases of murder. It does not, however, mean that the murderer should be killed in the same manner in which he committed the murder. It only means that his life should be taken as he took the life of the other.
177 The principle of the equality of the value of human life has been prescribed here in order to meet the strictest claims of justice. The value of blood and consequently retribution for it are not to be determined by the rank of the slain or that of the murderer. It has, therefore, been clearly laid down that the murderer himself shall be made to pay for the blood.
Before the advent of Islam, they put a higher value on the blood of a member of their own clan and demanded the life of a man of the same rank from the clan of the murderer or the lives of scores or even hundreds from the tribe of the murderer according to the value put on the blood of the slain.
On the other hand, if the murderer happened to belong to a higher rank than that of the slain, their “judgement” was that the life of the murderer should not be taken for the life of the slain. And this inequality in the evaluation of blood was not confined only to that age of ignorance. Even today the “civilised” nations are not ashamed of declaring openly that if one person of their nation is killed, they will take the lives of fifty men from the nation of the murderer. And they put these challenges into practice.
We often hear that so many people belonging to the subject nation have been put to death to avenge the murder of one person belonging to the ruling nation. But if the murderer belonged to a “civilised” ruling nation and the slain to an “uncivilised” subject nation, their judges would not pass the sentence of death on him. In order to guard against these unjust rules, Allah has ordained that the life of the murderer and the murderer alone should be taken for the life of the slain, irrespective of the rank or race of the murderer or that of the slain.
178 The use of the word “brother” here contains a kind of recommendation. That is, “Though the murderer has injured you very grievously, he is after all your brother by the human relation. Therefore, if you restrain your rage against your erring brother and refrain from retaliation and remit the penalty of death, you will raise your standard of humanity.”
This verse also shows that, according to the lslamic Penal Code, even murder is a compoundable offence.
The heirs of the murdered person have the right to pardon the murderer, if they deem it proper. In that case the court cannot insist on taking his life. Of course, the murderer will have to pay the blood money if the rightful claimants demand it.
179The word “ma’ruf” has been used in many places in the Qur’an. It refers to those just and rational rules of conduct which are generally known and accepted by all fair-minded people. They are so clear and well known that everyone who is not blinded by self-interest and prejudice will acknowledge them as right and just, and the Islamic law recognizes them in all those matters for which it has not laid down any regulations. Such common laws and general usages are termed “ma ruf .
180For instance, it will be transgression if the heirs of the slain try to retaliate even after accepting the ransom, or if the murderer does not mean to pay the ransom gracefully, or otherwise reacts in an ungrateful manner.
181This verse refutes the opinion of those people who go to the other extreme and advocate total abolition of capital punishment.
If it is inhuman to insist on retaliation, it is equally inhuman to encourage murder by totally abolishing capital punishment, as has been done in some “civilised” countries. That is why Allah declares that there is life for society in the law of retribution. If a society does not pay due regard to the sanctity of life and tries to protect a murderer, it sets a premium on crime and puts in danger the lives of many innocent people.” 
Tafseer Anwarul Bayan – By Shaykh Ashiq Ilahi Madni:
“SOME LAWS ABOUT RETALIATION (QISAS) AND BLOOD MONEY (DIYAH)
When the life of a murderer is taken in exchange for the life of the person whom he intentionally murdered, the term used by the Qur’an and Hadith is Retaliation (Qisas). Retaliation (Qisas) will only be taken in the case of intentional murder.
The details of this are to be found in the books of Islamic jurisprudence. The word retaliation (Qisas) denotes ‘likeness’ and equality, since a life is taken in exchange of another life. For this reason, the ruler and the subject, the big and the small, the rich and the poor are all alike. The differences and classes found among tribes and nations have no bearing in the matter of retaliation (Qisas).
If the heirs of the murdered person, or anyone of them wish to forfeit the retaliation (Qisas) in favour of some monetary settlement, this is called Diyah (blood money). If someone kills another person unintentionally, then too a monetary settlement is incumbent which is also called blood money (diyah). (There are various types of unintentional murder, the detailed laws of which are discussed in Surah Nisa).” 
Dr. Muhammad Asad:
“147 After having pointed out that true piety does not consist in mere adherence to outward forms and rites, – the Qur’an opens, as it were, a new chapter relating to the problem of man’s behaviour. Just as piety cannot become effective without righteous action, individual righteousness cannot become really effective in the social sense unless there is agreement within the community as to the social rights and obligations of its members: in other words, as to the practical laws which should govern the behaviour of the individual within the society and the society’s attitude towards the individual and his actions.
This is the innermost reason why legislation plays so great a role within the ideology of Islam, and why the Qur’an consistently intertwines its moral and spiritual exhortation with ordinances relating to practical aspects of social life. Now one of the main problems facing any society is the safeguarding of the lives and the individual security of its members: and so it is understandable that laws relating to homicide and its punishment are dealt with prominently at this place.
(It should be borne in mind that “The Cow” was the first surah revealed in Medina, that is, at the time when the Muslim community had just become established as an independent social entity.) As for the term qisas occurring at the beginning of the above passage, it must be pointed out that – according to all the classical commentators – it is almost synonymous with musawah, i.e., “making a thing equal [to another thing]”:
in this instance, making the punishment equal (or appropriate) to the crime – a meaning which is best rendered as “just retribution” and not (as has been often, and erroneously, done) as “retaliation”. Seeing that the Qur’an speaks here of “cases of killing” (fi’l-qatla, lit., “in the matter of the killed”) in general, and taking into account that this expression covers all possible cases of homicide – premeditated murder, murder under extreme provocation, culpable homicide, accidental manslaughter, and so forth – it is obvious that the taking of a life for a life (implied in the term “retaliation”) would not in every case correspond to the demands of equity.
(This has been made clear, for instance, in 4:92, where legal restitution for unintentional homicide is dealt with.) Read in conjunction with the term “just retribution” which introduces this passage, it is clear that the stipulation “the free for the free, the slave for the slave, the woman for the woman” cannot – and has not been intended to – be taken in its literal, restrictive sense: for this would preclude its application to many cases of homicide, e.g., the killing of a free man by a slave, or of a woman by a man, or vice-versa.
Thus, the above stipulation must be regarded as an example of the elliptical mode of expression (ijaz) so frequently employed in the Qur’an, and can have but one meaning, namely: “if a free man has committed the crime, the free man must be punished; if a slave has committed the crime…”, etc.- in other words, whatever the status of the guilty person, he or she (and he or she alone) is to be punished in a manner appropriate to the crime.
148 Lit., “and he to whom [something] is remitted by his brother”. There is no linguistic justification whatever for attributing – as some of the commentators have done – the pronoun “his” to the victim and, thus, for assuming that the expression “brother” stands for the victim’s “family” or “blood relations”. The pronoun “his” refers, unquestionably, to the guilty person; and since there is no reason for assuming that by “his brother” a real brother is meant, we cannot escape the conclusion that it denotes here “his brother in faith” of “his fellow-man” – in either of which terms the whole community is included.
Thus, the expression “if something is remitted to a guilty person by his brother” (i.e., by the community or its legal organs) may refer either to the establishment of mitigating circumstances in a case of murder, or to the finding that the case under trial falls within the categories of culpable homicide or manslaughter – in which cases no capital punishment is to be exacted and restitution is to be made by the payment of an indemnity called diyyah (see 4:92) to the relatives of the victim.
In consonance with the oft-recurring Qur’anic exhortation to forgiveness and forbearance, the “remission” mentioned above may also (and especially in cases of accidental manslaughter) relate to a partial or even total waiving of any claim to indemnification.
149 Lit., “and restitution to him in a goodly manner”, it being understood that the pronoun in ilayhi (“to him”) refers to the “brother in faith” or “fellow-man” mentioned earlier in this sentence. The word ada (here translated as “restitution”) denotes an act of acquitting oneself of a duty or a debt (cf. Lane I, 38), and stands here for the act of legal reparation imposed on the guilty person.
This reparation or restitution is to be made “in a goodly manner” – by taking into account the situation of the accused and, on the latter’s part, by acquitting himself of his obligation willingly and sincerely (cf. Manar II, 129).
150 Lit., “after this” – i.e., after the meaning of what constitutes “just retribution” (qisas) has been made clear in the above ordinance (Razi).
151 I.e., “there is a safeguard for you, as a community, so that you might be able to live in security, as God wants you to live”. Thus, the objective of qisds is the protection of the society, and not “revenge”.” 
Malik Ghulam Farid:
“204. The verse comprises a very important principle of civil law, i.e., equality of man and necessity of awarding proportionate punishment to all offenders without distinction, unless an offender is forgiven by the relatives of his victim under circumstances that are calculated to lead to improvement and betterment of conditions.
The words ‘is prescribed for you’ show that retaliation for the slain is obligatory. Failure to inflict the punishment prescribed by Law on the offender is tantamount to violation of the Divine commandment. The duty, however, of punishing the culprit devolves not on the heirs of the murdered person but, as the plural Alaikum (for you) shows, on the authorities responsible for the maintenance of law and order.
The former, however, have been given the option to forgive. So whereas on the one hand the concerned authorities are bound to punish the offender according to the requirements of law, having no right to pardon him of their own accord, on the other heirs of the murdered person are not entitled to take the law into their own hands and inflict the punishment on the guilty person themselves.
In awarding the punishment the verse makes no distinction between offenders. The words used are of a general nature and apply to all offenders who might be guilty of murder, no matter of what rank or station in life or of what religion. Any person, irrespective of his caste or creed and of his station, must be put to death for the murder of any other person, unless pardoned by the relatives of the victim and unless also the pardon has the sanction of the competent authorities.
The sayings of Holy Prophet are explicit on this point (Majah, ch. On Diyat). The companions of the Holy Prophet are all agreed that a Muslim may be put to death for murdering a non-belligerent disbeliever (Tabari, v. 44). The Holy Prophet himself ordered a Muslim murderer to be put to death for the murder of a non-belligerent non-Muslim (Qutni).
The words, the freeman for the freeman should and the slave for the slave and the female for the female, do not mean that a freeman should not be punished with death for the murder of a slave or that a woman should not be put to death for killing a member of the opposite sex, etc.
The social position of a person or the sex of a party also cannot be considered a bar to the application of this law. The peculiar construction, i.e., ‘the freeman for the freeman….’ Has been adopted to refer to, and abolish, a certain custom of the Arabs whereby they used to take into consideration the sex and the social status of the murderer and the murdered person when determining punishment.
The commandment contained in this verse seeks to abolish obnoxious custom. In fact, the law of retaliation, as stated in this verse, is confirmed to the clause, equitable retaliation in the matter of the slain is prescribed for you, which forms a complete sentence in itself, giving a full and complete meaning. The ensuing expression, the freeman for the freeman and the slave for the slave and the female for the female, is something extra, not forming part of the law.
It only contains a repudiation of the Arab custom referred to above and illustrates, by giving three instances, how the law is to be administered. Such an expression is known as Jumlah Isti’nafiah in Arabic grammar, and is technically introduced with a view to answering a question which is suggested by the preceding clause to which it is often added without any intervening conjunction.
The question answered in such an expression is often understood and not expressed (Mukhtasar). The Holy Prophet is reported to have said: ‘Whoever kills his slave shall be put to death (Majah). At another place he says:
‘The blood of all Muslims is alike in respect of the law of retaliation’ (Nasai).
204A. The Islamic law of retaliation provides a very effective means to put a stop to murder and safeguard human life. A man, who shows a callous disregard for human life loses all title to live as a member of human society.
Pardon or remission is permissible only where the circumstances are such that it is likely to improve matters and bring about good results for the suppression of crime, it has, on the other, kept open the door for the display of the noble qualities of benevolence and mercy.
The fact that, despite efforts to the contrary, the death penalty is still found on the statute books of most countries in one form or another constitutes a sufficient proof of the wisdom of the Islamic ordinance. Even the most enthusiastic protagonists of the abolition of capital punishment have not yet been able to suggest a suitable alternative to it.
They have had to admit that a long term of imprisonment as an alternative is ‘horrible’ and is ‘not an ideal substitute’ (Capital punishment in the twentieth century by E. Roy Calvert, G. P. Putnam, London, 1930).” 
Maulana Muhammad Ali:
“178a. The Jewish law of retaliation is greatly modified in Islåm, being limited only to cases of murder, while among the Jews it extended to all cases of grievous hurt. The words retaliation is prescribed for you in the matter of the slain, mean that the murderer should be put to death. After promulgating that law in general terms, the Qur’ån proceeds to describe a particular case, viz. that if a free man is the murderer, he himself is to be slain; if a slave is the murderer, that slave is to be executed; if a woman murdered a man, it was she that was to be put to death.
The pre-Islåmic Arabs used in certain cases to insist, when the person killed was of noble descent, upon the execution of others besides the murderer; they were not content with the execution of the slave or the woman, if one of them happened to be the murderer. The Holy Qur’an abolished this custom (AH, Rz).
178b. There may be circumstances which alleviate the guilt. In such cases the murderer may be made to pay a fine to the relatives of the murdered person. Such money is called diyat or blood-money. The reference to the alleviation of the guilt is plainly contained in the concluding words of the verse: This is an alleviation from your Lord. A comparison with 4:92 makes it clear that when homicide is not intentional, blood-money may be paid.
179a. Life cannot be safe, we are here told, unless those who are guilty of homicide are sentenced to capital punishment.” 
 Ma’ariful-Qur’an By Maulana Mufti Muhammad Shafi, volume 1, page 446 – 448
 Sayyid Abul Ala Maududi – Tafhim al-Qur’an – The Meaning of the Qur’an http://www.englishtafsir.com/Quran/2/index.html#sdfootnote176sym
 Illuminating Discourses on the Noble Quran – Tafseer Anwarul Bayan – By Shaykh Ashiq Ilahi Madni (r.a), volume 1, page 201
 The Message of The Quran translated and explained by Muhammad Asad, page 64 – 67 http://www.usc.edu/schools/college/crcc/private/cmje/religious_text/The_Message_of_The_Quran__by_Muhammad_Asad.pdf
 The Holy Qur’an – Arabic Text With English Translation & Short Commentary By Malik Ghulam Farid, Page 72 – 73
 The Holy Quran Arabic Text with English Translation, Commentary and comprehensive Introduction [Year 2002 Edition] by Maulana Muhammad Ali, page 77 – 78