According to Srimad Bhagavatam, as Lord Shiva was drinking the poison Halahala which emerged during the churning of the ocean, a little bit spilled from his hand. This became the venom in snakes and other creatures and also poisonous plants.