Joseph was Jacob's favorite son, which drove the oldest 10 sons into jealousy. When Joseph was sent to watch over his brothers, they plotted against him and decided to kill him and tell their father it was the cause of a vicious animal.
But Rueben took pity upon him and proposed they just throw him in a pit, so he could starve, But he was actually going to help get him out when the brothers left. While the brothers were eating, they saw Ishmaelites and decided to make money out of their brother.
Joseph was sold to the Ishmaelites for about 20 shekels of silver or 8 ounces of silver. The Ishmaelites took Joseph to Egypt, where he was given to a Potiphar, who was one of the Pharaoh's offical and the captain of the guard.