You were angry with the baker and me, and you put us in prison.
So Potiphar put Joseph into the prison where the king’s enemies were held, and that is where Joseph remained.
The Midianite traders later sold Joseph in Egypt. They sold him to Potiphar, an officer of the king of Egypt and the captain of his palace guards.