Genesis 39:1

Joseph and Potiphar’s Wife

39:1 Now Joseph had been brought down to Egypt. An Egyptian named Potiphar, an official of Pharaoh and the captain of the guard, purchased him from the Ishmaelites who had brought him there.

Genesis 39:20

39:20 Joseph’s master took him and threw him into the prison, the place where the king’s prisoners were confined. So he was there in the prison.