Ketubot 26 - A woman in prison

If a woman was imprisoned by the idolaters because of money matters - that is, she owed them money - then after her release she is permitted to her husband (the Kohen). Since by molesting her, they would be found guilty and may forfeit their rights to the money, they would be careful and refrain.

However, if she was imprisoned because of a capital crime, then she will be forbidden to her husband (the Kohen) if she is released - because the idolaters have nothing to risk and may molest her. A Kohen may not be married to a woman who has illicit relations with an idolater, even against her will. A different way to explain these rulings is in regards to even a husband who is not a Kohen, and here the suspicion is that she submitted to one of her captors willingly - which would make her prohibited to her current husband.

There was a Jewish girl in Ashkelon who pledged herself to idolaters as security for a debt; the loan was not paid, and she temporarily became the property of the idolaters. She was married to a Kohen, and her family distanced her from him and other brothers in case he would die. Her servants who testified to the event also testified that she was never secluded and was not violated. The family did not want to believe the servants, but the Sages said, "Either you believe them that she was pledged and also that she is pure, or don't believe them even that she was pledged!" This is another example of the rule, "the mouth that forbids also has the power to permit."

Art: The Artist's Servants by William Hogarth