McGonagall starts explaining the British wizarding legal system like someone who explains complicated things for a living, with a focus on "How did Azkaban start to be a thing and why is it so hard to get rid of."
There are three main parts to the problem. First, containing wizards is hard. They can't do much more than muggles can without wands, but any solution for keeping them alive and preventing outside people from breaking them out requires guards with wands, and then you need to prevent the prisoners from stealing wands off the guards.
Someone a long time ago decided to solve this problem with dementors, but that led to problem two: it turns out that confining a bunch of dementors in one cold damp place with a steady supply of victims causes them to breed, and now Britain has way more dementors per capita than anywhere else. There's no way to kill them, and releasing them would be both dangerous to the general population and likely to cause an international incident over the odds that some would wander across the Channel.
Problem three is that the government is corrupt and rarely does anything that doesn't benefit them personally, and even if they weren't there's a sizeable number of people who think prisoners are bad and therefore prisons should be as awful as possible.