Sorry for the ultra-necropost.
There is some belief that ALL snakes share a common ancestor with Monitor Lizards, Beaded Lizards, and the Bornean Earless Monitor... or at least they're all reasonably close to each other. Both species of beaded lizard are venomous and some of the monitors are (like the Lace monitor and Komodo). With that in mind the first snakes to ever appear were probably venomous or at least had the ability to create venom locked in their DNA somewhere.
Why some snakes are lethally venomous and others aren't I speculate has to do with their life styles. I honestly have no idea what good venom does for a lace monitor, but "non-venomous" snakes don't need venom because they can tackle their prey easily enough without it. A kingsnake can take out a rattlesnake with no venom, an anaconda can take down a caiman with no venom, etc. As for its defensive purposes All nonvenomous snakes probably benefit from batesian mimicry. People sure as hell can't tell the difference between a venomous and non-venomous snake. It is probably easier for most animals to beware of snakes in general opposed to specific individual species.
The venom in beaded lizards serves as a pain augmenter and pretty much nothing else. They certainly don't need it when hunting small rodents and bird eggs.