If they were falsely accused, then it was expected to kill everyone in their way.
Ask them to accept to show up for a trial, if they aren't judged yet.
Before the trial, a noble tells them that they need to go in prison for reason X. You also give them an escape plan. It might be something not smart, bound not to work. Players always believe the npc's when they have "awesome" plans (at least in every campaign I have played lol). Just make sure its not too obvious that it will fail, if you need to keep them in.
(And have a backup plan in case they think the plan will fail)
Then, if they agree to get arrested just do the trial and ship them in jail.
If they don't agree, maybe you should think of changing the adventure. If you can't, then have the courthouse be stormed with guards /many of them and low CR (this means many guards will die). Then they wake up in prison.
If a trial has taken place already, then you will either have to do something very creative, or just beat them to prison.
To be honest, I would get angry if my DM tried this on me.By this I mean the whole idea...
You may patch it up however by having some NPCs believing the PCs are innocent (this way it looks like a hidden enemy is against them, not the DM /corrupted judges etc). (Possibly the same NPCs who ask them to get into prison)
Also, you really want them to agree to go in the prison. This means that you have better make the deal sweet for everyone.