I don't know anyone know this but if you stay long enough in the prison, eventually the enemy will just let's you go (I test it many time before), but how soon they will release you depend on your relationship with them (if you have higher than 80 reputation with the faction that capture you, there is a chance they will just release you after like 10-20 turns). But if you reputation with them is so low (for example below 20) they will still release you but it take a very long time (more than 500 turns).
- My best tips for those who are capture by low reputation faction is to use the wait option and stand still (even if it mean that you will have to let them restrain you but you really can't do anything at that point anyway). Then they will release you after couple hundred of turns and all you need to do is try to escape and avoid any contact.
- It's also a good idea for you to save as much money as possible (more than 10k) so when you are captured either by accident or on purpose you can go and buy items at commercial shrine, which with enough spending they will open a portal to go to the shopkeeper then you can ask her to remove restrain.
- If you are playing as rogue (which I use the most), it's best for you to unlock the "problem solving" skill first (escape take longer but with better efficiency).