how legal justice deal with autism

just want to know how does legal justice deal with someone with autism. say someone with autism had commited a crime because they were very traumatised and depressed. will they still get send to prison or will there be other treatment for them?