Drinking poison hemlock was one of the forms of capital punishment in the Greek polis of Athens in the time of Socrates. In 399 BCE, Socrates was charged with the crimes of denying the existence of the gods and corrupting the minds of the youth. In many ways, these were trumped-up charges. It seems that Socrates's real transgression was questioning the value of democracy and praising the accomplishments and system of Sparta, Athens's chief rival. This was a difficult time for Athens. Its recent military defeats at the hands of Sparta and the crumbling of its democracy made Socrates an object of scorn for the local Athenian authorities. That is most likely why they found reasons to bring him to trial.
At any rate, Socrates was put on trial in front of a jury of five hundred fellow Athenians. A slim majority of jurors found him guilty on both charges. His accusers argued for the death penalty. Socrates was also given the opportunity to suggest his own punishment, which he said should be a trivial monetary fine. The jury ultimately chose death.
Drinking poison hemlock was a typical form of execution at the time in Athens. While more grievous crimes could result in execution by being thrown into a deep pit (barathron or orygma) or being clubbed to death (tympanon), Socrates was given the more somewhat more dignified death of forced suicide by poison.