There are a lot of reasons to be imprisoned. It can go from shoplifting, assault, murder, attempted murder, rape and a lot more. This is done to keep away those people who commit crimes away from the public for some time (depends how long the court decides).
Imprisonment isn't just for criminals but also for people with serious psychological problems. It is called an asylum and the most famous asylum in comics is Arkham Asylum.