Yes. This was part of God's plan for Joseph.
Joseph was sold and taken to Egypt. He became a slave in Poiphars hous. Joseph was put in jail. Joseph was taken out of jail. Joseph was put in charge of all Egypt.
Through these events God prepared the way for Joseph's family to come to Egypt during a famine. This is what Joseph said to his brothers when they met years after his brothers sold him as a slave:
Gen 50:20 But as for you, you meant evil against me; but God meant it for good, in order to bring it about as it is this day, to save many people alive.
Answer:
God has a purpose for everything.
1) In Potiphar's house, joseph gained experience in leadership (he became the head over all the other servants), which later served him well as viceroy of Egypt.
2) He was tested by Potiphar's wife (Genesis ch.39) and came out of it spiritually unscathed. this was part of the reason why God saw fit to later raise him to greatness.
being white
Joseph went to his beloved's house.
Joseph Elliston House was created in 1817.
Joseph Campau House was created in 1835.
Joseph Robbins House was created in 1820.
Joseph Haile House was created in 1806.
Joseph Andrews House was created in 1851.
Joseph Mitchell House was created in 1835.
Joseph Bohn House was created in 1872.
Joseph Willis House was created in 1688.
Joseph Story House was created in 1811.
Joseph Bucher House was created in 1811.