Those who have been diagnosed with mental illnesses are not jailed as per usual guidelines, however, most criminals are not successfully diagnosed. With worsening mental conditions, the average mentally ill criminal serves a significantly longer period of jail time.Therefore, at least 83% of inmates do not receive treatment and end up getting worse than before. Intervention is offered by organisations such as NAMI.
Hope this helped! :)