Al-Nawawi remarks: This ḥadith recommends concealing the fault of a Muslim when one becomes aware that he has committed an indecent act, for the Exalted says, “Those who love for indecency to spread among the believers will have a painful punishment in this world and the Hereafter; Allah knows, and you do not know” (24:19).
It is likewise recommended that anyone who has fallen into sin should conceal it from others.
Ibn Daqīq al-ʿĪd, in his commentary on the Forty Ḥadith, explains: The directive pertains to covering the slips of people of standing and the like—those who are not known for habitual corruption. This concerns a sin that has already occurred and is now over. If, however, one knows that the person is still engaged in the sin, he must immediately censure him and prevent him from it; if he is unable to do so, he is required to report the matter to the ruler, provided that no greater harm will result.
As for the one who is openly immoral, he is not to be covered, because concealing his conduct would embolden him to further corruption, harm, violation of sacred limits, and would encourage others to do the same. Instead, he should be referred to the ruler, so long as this is not likely to cause a greater evil.
The same principle applies to evaluating ḥadith transmitters, witnesses, and trustees over charity funds, endowments, orphans, and similar responsibilities: when their unreliability becomes apparent, it must be exposed whenever there is a need; concealing it is unlawful. This is not the forbidden backbiting but the obligatory counsel.
Ibn Rajab says in his explanation of the Forty Ḥadith: Know that people fall into two categories.
The first consists of those whose outward state is upright and who are not known for any sin. If such a person slips or errs, it is impermissible to publicize, expose, or speak of it, for that would be prohibited backbiting. This is what the revealed texts address. Concerning this Allah says, “Those who love for indecency to spread among the believers will have a painful punishment in this world and the Hereafter; Allah knows, and you do not know” (24:19). Here, “spreading indecency” refers to making public what has occurred to a believer, or what he is accused of while he is innocent of it.
One of the righteous ministers once said to an enjoiner of good: “Strive to conceal…"