To contain the dissemination of vice, Islam has taught its followers to conceal whatever sins and acts of
disobedience they slip into. As long as Allah has cast concealment on a wrong act, a Muslim should not uncover this concealment. Bragging about sins and evil doings may tempt people with weak faith and tenuous characters to act likewise.
However, though this is the main principle, there are cases when a Muslim may talk about his or her weaknesses, such as to seek remedy or help from others.
Answering this question, Dr. Hatem Al-Haj, dean of Shari`ah Academy of America, stated,
There is no doubt that Allah likes concealment, and one of His names is As-Sitteer, that is, the One who conceals and cloaks [Sunan Abu Dawud].
As for the vice of divulging one’s sins, there is the following hadith, which was reported by Al-Bukhari and Muslim on the authority of Abu Hurairah (may Allah be pleased with him), who said: I heard the Messenger of Allah (peace and blessings be upon him) saying, “All of my Ummah will be forgiven except those who divulge their sins. And part of divulgence is when a man errs at night, and after Allah conceals his sins, in the morning, he says, ‘I did such and such last night,’ uncovering Allah’s cloak of secrecy after He veiled him.”
Nevertheless, you do notice, in this hadith and similar ones, that the individual who divulged his own sins and didn’t accept Allah’s cloak of secrecy did that to boast about his own wickedness and moral weakness.
It is established in the Sunnah of the Prophet, though, that his Companions came and complained to him, both in seclusion as well as in front of others, about their weaknesses and faults. They were seeking from him to ask Allah to pardon them or to purify them by the prescribed punishment or to tell them of the necessary expiation, etc.
Thus, the difference is in the intentions and motives. While concealment is still favored whenever possible, to tell of one’s weaknesses in pursuit of therapy and support to recover from them wouldn’t fall under the ruling on divulgence mentioned in the foregoing hadith.
There is another concern that is pertinent to this case as well, which is the effectiveness of group psychological and behavioral therapy for those individuals. That is because the recognition of motives is important, but it is also important to be aware of the consequences (ma’alaat) of the particular action inquired about.
If it is true that group therapy is beneficial and doesn’t result in harm greater than the anticipated benefits, then the participation of Muslims in it with the intent of seeking therapy and correction of certain negative attitudes would be advisable. We were told that individuals don’t have to mention the details of specific sins, but rather describe their weaknesses in certain areas, in general terms. That is what we recommend.
Finally, if it is true that the Muslim prisoners may suffer from additional burdens or loss of privileges as a consequence of their absence from such sessions, then it is clear, in my own point of view, that their attendance would be at least permissible.