From the first episode, or maybe within the first few, we find out that Michael has done extensive planning for freeing his brother. This included getting the plans to the prison tattooed across his entire body.
He also researched the legal procedures for getting himself sent to a maximum security prison. As he had no priors, the best way to get sent to a maximum security prison was to discharge a lethal firearm in the presence of innocent civilians (in the bank).
So now the court recognizes that he is currently a danger to society, so they will attempt to prosecute him and send him to a max security facility. If the crime had been anything less (for example trying to rob the bank without discharging the gun), they probably wouldn't have agreed to send him there.
However, the court doesn't want an extended trial process. Most people, when they admit to being guilty, get a reduced sentence for their crime. This is so that they are more inclined to testify guilty, to avoid the long and expensive court process.
However, Michael doesn't ask for reduced time for pleading guilty (he's planning on escaping anyway). The only thing he asks for is to be sent to Fox River.
For the prosecution, this is a dream scenario. The prosecuting attorney essentially gets a free win. They get to send a dangerous criminal to a max security jail for the maximum sentence, and that's without a trial. On their record, this looks good, so in order to get this they would be willing to agree in a plea deal to Michael going to Fox River. He's going to a max security prison, why would they care which one?
Michael has done enough research to know this. Whilst it is possible that they wouldn't agree to his demands, it is highly unlikely. He maneuvers the court proceedings in order to get exactly what he wants, by giving them exactly what they want.