Genesis 39:19-21

19 And it came to pass, when his master heard the words of his wife, which she spake unto him, saying, After this manner did thy servant to me; that his wrath was kindled.

20 And Joseph's master took him, and put him into the prison, a place where the king's prisoners were bound: and he was there in the prison.

21 But the LORD was with Joseph, and showed him mercy, and gave him favor in the sight of the keeper of the prison.