Narrated 'Ubada bin As-Samit: I, along with a group of people, gave the pledge of allegiance to Allah's Apostle. He said, "I take your Pledge on the condition that you (1) will not join partners in worship with Allah, (2) will not steal, (3) will not commit illegal sexual intercourse, (4) will not kill your offspring, (5) will not slander, (6) and will not disobey me when I order you to do good. Whoever among you will abide by his pledge, his reward will be with Allah, and whoever commits any of those sins and receives the punishment in this world, that punishment will be an expiation for his sins and purification; but if Allah screens him, then it will be up to Allah to punish him if He will or excuse Him, if He will."
— Sahih Bukhari, Volume 9, Book 93: Oneness, Uniqueness of Allah (Tawheed), Hadith #560
Narrated 'Ubada bin As-Samit: I, along with a group of people, gave the pledge of allegiance to Allah's Apostle. He said, "I take your Pledge on the condition that you (1) will not join partners in worship with Allah, (2) will not steal, (3) will not commit illegal sexual intercourse, (4) will not kill your offspring, (5) will not slander, (6) and will not disobey me when I order you to do good. Whoever among you will abide by his pledge, his reward will be with Allah, and whoever commits any of those sins and receives the punishment in this world, that punishment will be an expiation for his sins and purification; but if Allah screens him, then it will be up to Allah to punish him if He will or excuse Him, if He will."
This hadith is from the book of Oneness, Uniqueness of Allah (Tawheed) in Sahih Bukhari, compiled by Imam al-Bukhari. It is hadith number 560 in book 93 of volume 9.
This hadith is referenced in the following topics: Stealing, Gossip & Rumours, Oneness of Allah - Tawheed, Extramarital Relations.