As we read the story of Joseph being sold into slavery just some quick notes on things to notice.
Joseph is the first son of Rachel. Recall the Jacob had gone to live with Laban. He wanted to marry Rachel but Laban substituted Leah on their wedding night. Jacob didn’t love Leah but he stayed married to her and they had children together. The first son of Jacob and Leah is Reuben. When the scene plays out and the brothers decide to kill Joseph or sell him into slavery it is Reuben who convinces the group not to kill their brother. So you have a situation where the first first-born son saves the second first-born son.
Joseph is sold to Ishmaelites. These are descendants of Ishmael. Recall that Ishmael was Abraham’s son by his slave Hagar, whom Abraham did not love (or certainly loved less than is wife Sarah). Ishmael was born first, but Abraham’s true heir was his first born son of Sarah. That was Isaac, who is Joseph’s grandfather. So the pattern is repeating itself. Joseph, the favored son is being sold to the descendants of Abraham’s unfavored first born son. Notice on sin (in this case Abraham and Sarah’s failure to trust God that He would provide them a son) has repercussions far out in time.
Notice, Joseph is sold for twenty pieces of silver. Of course, Jesus will ultimately be sold for thirty pieces of silver.
Looking forward, Joseph will eventually rise to prominence in Egypt. A famine will come and his family will travel to Egypt in search of food, specifically grain to make bread. This is important as bread links this story together with all the other major events of salvation history.
Also note that it is this selling of Joseph into slavery in Egypt that ultimately leads to the enslavement of the Jewish people in Egypt. Joseph family will remain in Egypt and multiply. When their numbers grow, they will be deemed a threat and enslaved. Again we see that sin can have repercussions far off into the future.