To ostracize someone is, literally, to vote them out with a broken pot.
The Greek noun ostrakon meant a potsherd or tile. Merriam-Webster adds that it could also mean an earthen vessel or a shell. Athenians used these fragments as ballots, and the verb ostrakizein meant "to banish by voting with potshards." English took it in the 1640s, with Merriam-Webster giving 1649, first for formal banishment and soon for general social exclusion. The related noun ostracism is recorded earlier, in the 1580s.
The procedure, as World History Encyclopedia describes it, worked like this. Each year the assembly decided whether to hold an ostracism. If it agreed, citizens met in the agora and scratched the name of a candidate on a potsherd. Voting was anonymous. A minimum of 6,000 votes was required, and the person with the most votes was exiled with no appeal.
He had ten days to leave and could not return to Attica for ten years. He did, however, keep his citizenship and property. It was a cooling-off period, not a punishment for a crime.
Aristotle credits the reformer Cleisthenes with creating the process around 508 BCE, as a defense against tyranny. The first recorded ostracism was around 487 BCE. Famous victims include Aristides in 482 BCE, later recalled, and Themistocles around 471 BCE.
Plutarch tells a story about Aristides, called "The Just." One voter, asked why he wanted him gone, said he was tired of hearing him called that. One find of about 190 ostraka naming Themistocles, in a well near the Acropolis, shows handwriting suggesting that a few people wrote many of them, possibly to rig the vote.
The last recorded ostracism, around 416 or 415 BCE, backfired. Hyperbolus hoped to exile a rival, but Alcibiades and Nicias joined forces and he was sent away himself.
Syracuse had a similar practice that used olive leaves, called petalismos. Leaves did not give the word to English, though. The pottery did.