Yeah, that does kind of suck. You do a mission and get thrown in jail.

Originally Posted by Mr_Blastman
The caterpillar rescue prisoner mission.

On the other hand, you did just attack a prison ship and tried to spring the prisoners, so, what did you expect was going to happen?

There's guides on breaking out of prison, it's not too hard, you just have to have someone pick you up on the planet's surface. Then, try to avoid running into bounty hunters.
You could also just try hunting down escaped prisoners. It's dangerous, but pays well.