So when the Midianite merchants came by, his brothers pulled Joseph up out of the cistern and sold him for twenty shekels of silver to the Ishmaelites, who took him to Egypt.Genesis 37:28
God is creating a people, a family. But this family is pretty dysfunctional. Favouritism from the father causes conflict between the sons. Even God given visions increase that conflict until eventually Joseph is sold into slavery by his brohters who have only just stopped short of killing him.
This sin and family conflict is bad. It is not how God designed for families to be together. Their sin is theri fault. But it does not, and can not, de-rail God's plan. This event will be used by God to fulfil his purposes.
No matter how crazy things get in my life, God has not forgotten, or abandoned His plan.