It seems such an illogical way to determine guilt, yet it is often referenced in books and tv-shows set in a medieval stage (namely Game of Thrones). Did people actually do this, or is it just an easy way to introduce a fight into a tv-show?
Yes, they were a thing. Have a look at this thread by /u/TheGreenReaper7 from a few weeks ago. It was in response to a question virtually identical to yours.
I just came across this article by Dr. Steven Isaac of Longwood University that tackles this very question.