Genesis 39 NASB
1 Now Joseph had been taken down to Egypt; and Potiphar, an Egyptian officer of Pharaoh, the captain of the bodyguard, bought him from the Ishmaelites, who had taken him down there. 2 The Lord was with Joseph, so he became a successful man. And he was in the house of his master, the Egyptian. 3 Now his master saw that the Lord was with him and how the Lord caused all that he did to prosper in his hand. 4 So Joseph found favor in his sight and became his personal servant; and he made him overseer over his house, and all that he owned he put in his charge. 5 It came about that from the time he made him overseer in his house and over all that he owned, the Lord blessed the Egyptian's house on account of Joseph; thus the Lord's blessing was upon all that he owned, in the house and in the field. 6 So he left everything he owned in Joseph's charge; and with him there he did not concern himself with anything except the food which he ate.
Now Joseph was handsome in form and appearance. 7 It came about after these events that his master's wife looked with desire at Joseph, and she said, "Lie with me." 8 But he refused and said to his master's wife, "Behold, with me here, my master does not concern himself with anything in the house, and he has put all that he owns in my charge. 9 There is no one greater in this house than I, and he has withheld nothing from me except you, because you are his wife. How then could I do this great evil and sin against God?" 10 As she spoke to Joseph day after day, he did not listen to her to lie beside her or be with her. 11 Now it happened one day that he went into the house to do his work, and none of the men of the household was there inside. 12 She caught him by his garment, saying, "Lie with me!" And he left his garment in her hand and fled, and went outside. 13 When she saw that he had left his garment in her hand and had fled outside, 14 she called to the men of her household and said to them, "See, he has brought in a Hebrew to us to make sport of us; he came in to me to lie with me, and I screamed. 15 When he heard that I raised my voice and screamed, he left his garment beside me and fled and went outside." 16 So she left his garment beside her until his master came home. 17 Then she spoke to him with these words, "The Hebrew slave, whom you brought to us, came in to me to make sport of me; 18 and as I raised my voice and screamed, he left his garment beside me and fled outside."
19 Now when his master heard the words of his wife, which she spoke to him, saying, "This is what your slave did to me," his anger burned. 20 So Joseph's master took him and put him into the jail, the place where the king's prisoners were confined; and he was there in the jail. 21 But the Lord was with Joseph and extended kindness to him, and gave him favor in the sight of the chief jailer. 22 The chief jailer committed to Joseph's charge all the prisoners who were in the jail; so that whatever was done there, he was responsible for it. 23 The chief jailer did not supervise anything under Joseph's charge because the Lord was with him; and whatever he did, the Lord made to prosper.