Narrated Ikrimah: The Holy Prophet ﷺ said to Ibn Suriya': I remind you by Allah Who saved you from the people of Pharaoh, made you cover the sea, gave you the shade of clouds, sent down to you manna and quails, sent down you Torah to Moses, do you find stoning (for adultery) in your Book? He said: You have reminded me by the Great. It is not possible for me to belie you. He then transmitted the rest of the tradition.
The punishment of stoning someone who commits adultery is mentioned in many religious texts, including the Quran and Hadith. This punishment serves as a reminder to people about how serious this sin is and how important it is to stay away from it at all costs. It also serves as a deterrent against committing such acts in society so that people can live peacefully with each other without fear of being punished or judged harshly by others.