Very closely related (on Science Fiction SE): Why did the wizarding society seem to have such a weak view of civil rights?
Following the answers there, people that were sent to prison without trials (e.g. Hagrid, who was sent to prison without even having been charged with anything "as a precaution," or Sirius Black, who at least had clear charges against him even if he wasn't actually tried) "because of fear and political expediency," as the accepted answer on the linked question says. In the case of Hagrid, quite simply, the Ministry wants to be seen as doing something. The fact is they have no clue what the Monster of Slytherin was and they were completely powerless to stop it, but of course they couldn't/wouldn't actually admit that.
Scrimgeour was quite explicit about this when discussing the case of Stan Shunpike with Harry:
“Well, of course, to you it will matter enormously,” said Scrimgeour with a laugh. “But to the Wizarding community at large ... it’s all perception, isn’t it? It’s what people believe that’s important."
(Half-Blood Prince, Chapter 16, A Very Frosty Christmas).
It's worth noting at this point that Muggle societies aren't above holding people in prison without charges, trials or habaes corpus out of fear (consider, for example, internment of Japanese in the U.S. during WWII or certain other more recent events - I'll let you draw the inference as to which ones I'm referring to), so perhaps we shouldn't be entirely surprised to learn that Wizarding society has done the same thing.
With that said, as discussed in the other Q&A, Wizarding society's view of civil rights seems to be considerably weaker and less "modern" than current views of civil rights, and there were major procedural problems with the trials when they were held at all (e.g. the fact that the chief law enforcement officer also served as both the chief judge and chief prosecutor). These procedural flaws are a major reason that Cornelius Fudge's blatant attempt to railroad Harry Potter nearly succeeded.