One source of the story of Plato being sold into slavery is Lives and Opinions of Eminent Philosophers by Diogenes Laërtius. An English translation is available online on Project Perseus. You can find the full story in Book 3 that discusses the life of Plato.
According to Laërtius, Plato angered Dionysius, the tyrant of Sicily, when he suggested that "the interest of the ruler alone was not the best end". Dionysius was going to execute the philosopher but was convinced to spare his life and sell him into slavery instead by Dion, his brother in law and a student of Plato.
The philosopher was then taken to the island of Aegina to be sold. There, he was recognised by someone called Anniceris and was ransomed for twenty minas. We don't know for sure who this Anniceris was, one possibility is the Cyrenaic philosopher. Laërtius also mentions that Dion may have provided the money for the ransom to Anniceris.
Plutarch (Life of Dion, 5) and Diodorus Siculus (Library, 15) also mention the story.