All societies have a system of punishment for serious criminal offences. The modern system uses prolonged prison terms, but many criminal and social science experts have observed that jail time is not a successful deterrent, and that it most often leaves a sense of loss and uselessness for the criminal, and general maliciousness towards the system perceived as unjust.
Also the victims often do not believe that true justice has been served. Many controversies exist about appropriate terms and sentencing. Not to mention the expenses in maintenance of a huge system of prisons and related facilities.
One of the prescribed punishment in Islam is Stoning or Rajam for the Married Adulterer. 
رَجْم : رَمْيٌ بِالحِجَارَة- pelting with stones; stoning; throwing stones at 
For The married adulterer, the punishment in this case is to be stoned to death or Rajam (رجم).
Al-muhsan or the married person here means one who got married and had intercourse with his wife in the vagina, in a legitimate marriage in which both parties are free, of sound mind and adults.
If a married man or woman commits adultery, then they are to be stoned to death, because the Prophet ﷺsaid: “Learn from me. Allaah has given them a way out. If an unmarried person commits fornication with an unmarried person, (the punishment is) one hundred lashes and exile for one year. If a married person commits adultery with a married person, (the punishment is) one hundred lashes and stoning.”Sahih Muslim, 1690.
It is narrated from Abu Hurayrah and Zayd ibn Khaalid al-Juhani (may Allaah be pleased with them) that they said: “Two men from among the Bedouin came to the Messenger of Allaah ﷺand said, ‘O Messenger of Allaah, I adjure you by Allaah to judge me according to the Book of Allaah.’ The other disputant – who was smarter – said: ‘Yes, judge between us according to the Book of Allaah and give me permission to speak first.’
The Messenger of Allaah ﷺsaid, ‘Speak.’ He said, ‘My son was employed by this man, and he committed adultery with his wife. I was told that the punishment for my son would be stoning, but that he could be ransomed for one hundred sheep and their offspring. I asked the people of knowledge and they told me that the punishment for my son would be one hundred lashes and exile for one year, and that this woman would be stoned.’
The Messenger of Allaah (ﷺ) said: ‘By the One in Whose hand is my soul, I will judge between you according to the Book of Allaah. The offspring and sheep will be returned (i.e., there is no ransom), and your son is to be given one hundred lashes and exiled for one year. O Unays [who was one of the Sahaabah], go tomorrow to that woman and if she admits (this crime) then stone her.’ So he went to her the next day and she admitted it, and the Messenger of Allaah (peace and blessings of Allaah be upon him) issued orders that she be stoned.Sahih Bukhaari 2725 and Sahih Muslim 1698 
The ayath that states the ruling of stoning was revealed to the Prophet ﷺand then abrogated as a text in the Quran, but its ruling has been still valid and operative. The proof for Stoning is also available in the Hadith.
Umar ibn al-Khattaab (may Allaah be pleased with him) said, when he was sitting on the minbar of the Messenger of Allaah ﷺ: “Allaah sent Muhammad ﷺwith the truth, and revealed to him the Book. One of the things that He revealed was the ayath of stoning, which we have read and understood. The Messenger of Allaah ﷺcarried out the punishment of stoning and we did so after him. I fear that as time goes by, people will say, ‘We do not find any mention of stoning in the Book of Allaah,’ so they will go astray by forsaking an obligation that was revealed by Allaah. In the Book of Allaah, stoning is the punishment deserved by any previously-married person, man or woman, who commits adultery, if proof is established, or pregnancy results, or he or she confesses.” Sahih Bukhaari, 2462; Sahih Muslim, 1691 
Allah says: "If any of your women are guilty of lewdness, take the evidence of four (reliable) witnesses from amongst you against them; and if they testify, confine them to houses until death do claim them, or Allah ordain for them some (other) way." Surah Al Nisa 4:15
Ibn Katheer, may Allah have mercy on him, said in his Tafseer (explanation) of this aayah:
"At the beginning, the ruling concerning a woman who was proven guilty of adultery was that she was to be detained in a house and not allowed to come out until she died. So the phrase ‘If any of your women are guilty of lewdness’ refers to adultery. ‘Take the evidence of four (reliable) witnesses from amongst you against them; and if they testify, confine them to houses until death do claim them, or Allah ordain for them some (other) way’ - the ‘other way’ that Allah made for them was the abrogation of this.
Ibn ‘Abbas, (R), said: ‘This was the ruling until Allah revealed Surat al-Nur, then this punishment was abrogated and replaced with whipping or stoning.’ Something similar was reported from ‘Ikrimah, Sa‘id ibn Jubayr, al-Hasan, ‘Ataa’ al-Khurasani, Abu Saalih, Qutaadah, Zayd ibn Aslam and al-Dahhak, stating that this is abrogated, and this is agreed upon.
Imam Ahmad said: ‘Muhammad ibn Ja‘far told us that Sa‘id told us from Qutaadah from al-Hasan from Hattaan ibn ‘Abdullah al-Raqaashi from ‘Ubaadah ibn al-Saamit who said: Whenever the wahy (revelation) descended upon the Messenger of Allah ﷺ, it affected him, the stress showed on him and his face would change. Allah sent a revelation to him one day, and when it was over, he said: " Listen to me, Allah has made another way for them. (When) a married man (commits adultery) with a married woman, and an unmarried man with an unmarried woman, then in the case of married (persons) there is (a punishment) of one hundred lashes and then stoning (to death), and in the case of unmarried persons, (the punishment) is one hundred lashes and exile for one year."’ It was reported by Muslim and other narrators of Sunan via Qutaadah from al-Hasan from al-Hattan from ‘Ubaadah ibn al-Saamit from the Prophet ﷺwith the wording: ‘Receive (teaching) from me, receive (teaching) from me. Allah has made another way for those (women).
When an unmarried man commits adultery with an unmarried woman, (they should receive) one hundred lashes, and banishment for one year. In the case of a married male committing adultery with a married female, they should receive one hundred lashes and be stoned to death.’ Al-Tirmidhi said: This is a saheeh hasan hadeeth."
This punishment is only applicable and executed when specific conditions are met.
A married male or female is stoned to death in either of the following two cases: confession or the testimony of four eyewitnesses. Open and clear confession entails that no compulsion or force is exerted to obtain a confession.
The sentence is not executed after the first admission of guilt. The confession will become effective only if it is repeated four times or in four different meetings or court sessions. The judge may say something to the effect, ‘It could be that you just kissed, hugged and touched without penetration.
This is to leave the door wide open for withdrawal of the original confession. This practice is based on the Sunnah of the Prophet (ﷺ) when the various confessors insisted repeatedly that they had actually committed adultery, and when one was proved pregnant as a result.
The second situation requires four just witnesses. These four just and fair witnesses must be known as truthful in their statements and conduct. The four witnesses must confirm observation of the actual intercourse directly, meaning that the four witnesses testify that they actually saw penetration of the male’s penis into the female’s vagina. Such a situation is truly rare and only observed when the two parties are openly committing such an illegal act of indulgence, showing no respect to the laws, honor and dignity of the society.
Adultery and fornication (from a purely Islamic perspective) are not considered, as in secular law, to be merely a personal prerogative and private affair. It is considered an infringement on the rights of the society (especially honor of the family of the woman) because there are many harmful effects and consequences. It demoralizes the social values and principles of the society in general.
It leads to the spread of venereal diseases. It leads to abortion. It leads to illegitimate children without proper care from parents. Mixing of the lineage occurs when a child is attributed to a person other than his real father. A child may be deprived of the honor of being attributed to his real father. It causes problems in inheritance whereby those who are not entitled to inheritance may become heirs and those who are entitled may not get any of the inheritance.
Furthermore, a person may even marry out of ignorance someone permanently forbidden to him to marry, such as a sister, a niece or an aunt, etc. It is truly a crime to these innocent children to deprive them of the guardianship of parents and family as well as an honorable identity, which may lead to physiological and social illness and instability. For a child a mother and father are essential for peace of mind, shelter, security, support and happiness. 
It may be noted that often the media propagates a distorted image about Islam, Muslim society, and the Shari’ah law. By this propaganda one may think that Islamic punishments are applied and executed on a daily basis. The truth is that throughout the Islamic history the instances where the punishment of execution, stoning to death and amputation, were recorded and applied are not many.
For instance the cases of stoning were rare and usually based on the request of the sinners who confessed their crimes and expressed their desire to receive the punishment in order to purify themselves from the sin they committed, in this world and meet Allah sinless in the Hereafter. The case with the other punishments is similar.
The early history of Islam recorded a few instances of confession of the crime of adultery wherein the individuals openly confessed their crime because their strong faith in Allah propelled them to the desire for sincere repentance and purification. As the traditions make clear, Allah will not punish someone twice for the same crime, and they wanted to be protected from having the punishment in the Hereafter. It should be noted that if sexual penetration and intercourse does not fully take place - if a person, for instance only kisses, hugs or touches – then there is no application of the punishment.
The penalty of false accusation for those who do not produce evidence to support their claims and accusations is eighty lashes, and a further punishment is that their testimony is thereafter rejected. As Allah says in the Glorious Qur'an: ‘and those who accuse chaste women, and produce not four witnesses, (to support their allegations), flog them with eighty stripes; and reject their testimony ever after: for such men are disobedient. Surah Al Noor 24:4