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 Horton House was created in 1752.
Joseph Kirkwood House was created in 1846.
Joseph Paris House was created in 1920.
Joseph A. Hemann House was created in 1870.
Joseph Shinn House was created in 1742.
Joseph Perkins House was created in 1840.
Joseph Armstrong House was created in 1888.
Joseph Davis House was created in 1884.
Joseph Willis House was created in 1688.
Joseph Story House was created in 1811.