To have stoning as a maximum punishment for a very limited type of offence is a minority interpretation leading to the formulation of certain penal codes within some inflections of Shariah. This interpretation was more common amongst scholars from the pre-modern era. It is positioned more as a deterrant than as an actual punishment, as it is practically impossible to attain a conviction in a fair Shariah court. (You need 4 witnesses to separately give detailed identical testimony, having witnessed actual penetration.)
Shariah Law is a legal system that deals with every facet of law in a society. Actual penal codes and punishments differ from time to time and place to place, and there is no "universal" Shariah. There are four different legal traditions in mainstream Islam, but even within the 4 schools, differences abound. Of the many unrepresentative and corrupt regimes who implement "Shariah", most limit it to Personal Law, as it would be very difficult for the despotic rulers to stay in power if the true liberating Shariah is implemented in its entirety. Regimes only apply Shariah outside of Personal Law when it serves the interests of the regime, often with gross perversion or deliberate misinterpretation, as in the case of stonings. The wave of liberty is splashing across some Muslim nations right now, drowning the despots, and it would be interesting to see how the imminent democratic Muslim societies will implement law.
The only two countries that currently comprehensively apply a version of "Shariah" are Iran (a Shia country with a dinstinct "Shariah", not part of the over 90% mainstream Muslims, but Shias are less than 10% of all Muslims; and Iranian judiciary spokesman Ali Reza Jamshidi said that stoning would be removed from the soon to be implemented penal code in the new legislation) and Saudi Arabia (a Wahhabi country with a distinct "Shariah", not part of the mainstream, but Wahhabis are less that 1% of all Muslims). It is nonsensical for the mainstream majority to answer for deviations from the mainstream, who have their own primary sources and their own exegetical methodolgy.
There are over 50 Muslim-majority countries in the world, and only 7 i.e. SEVEN of them have interpretations that lead them to include stoning in their legal systems, some in a very obscure form that it is not possible to implement. For instance, Indonesia has stoning as punishment for adultery only in the Aceh province and this has not been implemented even once. In Afganistan it is only the extremist Taliban group that implements it. In Nigeria, NO STONINGS HAVE EVER HAPPENED. In Somalia, the government condemns this practice, but the 2 times it happened in the last decade it was carried out by criminal extremist groups within the country, Al-Shabaab, and by the militant Hizbul Islam.
To reiterate, there are so many safeguards built into the Shariah Legal system, that it is virtually impossible to attain a verdict that could lead to stoning. The Prophet Muhammad only pronounced and carried out this upon three Muslims (one man and two women) - and two Jews, (a man and a woman - stoning is part of Jewish dispensation as well).
Muslims who have committed adultery often approach Islamic scholars for advice, and they are then advised to not make knowledge of any sins public, but to intend never to do it again and to repent, and to assume God's acceptance of the repentance. Stoning is never suggested as an avenue for purification.
In all 3 instances of stoning of Muslims taking place during the life-time of the Prophet, the guilty individuals voluntarily sought out the Prophet and insisted on this punishment. In the case of the Jews: they were brought to the Prophet for judgement by other Jews, and the Prophet requested the relevant sections of the Torah (Old Testament) be read out, and he then issued his ruling based on this.
Consider the Hadith below:
Reported by many companions that Ma'iz went before Prophet Muhammad in the Mosque and said, "I have committed adultery (zina), please purify me." Prophet Muhammad turned his face away from him and said "Woe to you, go back and pray to Allah for forgiveness." But the man again came in front of prophet Muhammad and repeated his desire for purification. The act was repeated three times, until Abu Bakr, sitting close by, told the Ma'iz to leave, as the fourth repetition of the plea would get him stoned. But the man persisted.Prophet Muhammad then turned to him and said "you might have kissed or caressed her or you might have looked at her with lust (and so assumed that you committed zina)". Ma'iz replied in the negative. Allah's Apostle said "did you lie in bed with her?" Ma'iz replied in the affirmative. He then asked, "did you have sexual intercourse?" Ma'iz replied in the affirmative. Then Prophet Muhammad got quite uncomfortable, and asked "Did your male organ disappear in the female part?" Ma'iz replied in the affirmative. He then asked, once more, whether Ma'iz knew what zina means. Ma'iz replied "yes, I have committed the same act a husband commits with his wife." Prophet Muhammad asked if he was married, and he replied "yes".Prophet Muhammad asked if he took any wine, and Ma'iz again replied in the negative. Prophet Muhammad then sent for an inquiry from the neighbors of Ma'iz, whether or not Ma'iz suffered from insanity. The replies all came in the negative. Prophet Muhammad then said, "had you kept it a secret, it would have been better for you." Prophet Muhammad then ordered Ma'iz to be stoned to death. During the stoning, Ma'iz cried out, "O people, take me back to the Holy Prophet, the people of my clan deluded me." When this was reported to Prophet Muhammad, he replied "Why did you not let him off, he might have repented, and Allah may have accepted it."
See video below: