When Joseph was taken to Egypt by the Ishmaelite traders, he was purchased by Potiphar, an Egyptian officer. Potiphar was captain of the guard for Pharaoh, the king of Egypt.