If you get inprisoned, there is a chance that an allied faction will try to break you out. If your standing with a faction is high enough, you will get an offer to join them, which gives you their uniform. Allied faction members are much more willing to help you out of bondage.