Originally, Joseph, son of Jacob, was sold into slavery by his brothers. He rose to power there and became Grand Vizier. When the period of famine came, Jacob and his family ended up going to Egypt at Pharaoh's invitation to live and prosper there in the Land of Goshen. This you can read about in the last 12 or 15 chapters of Genesis. And Exodus of course, begins with verse 8 of the 1st chapter saying "and there arose a in Egypt a Pharaoh who did not know Joseph."
That is when they were made slaves.