I wonder if this sort of thing has long been as frequent at this level, or if for some reason there’s more of it lately. I also wonder if the proliferation of email has something to do with it. Email is so easy, so spontaneous, so tempting (ask Anthony Weiner if you don’t believe me). And it gives the illusion (to some people, anyway) of privacy.
After all, if your wife, for example, doesn’t have access to your email account passwords, she can’t see it. Trouble is, a lot of other people can, if they’ve a mind to. And if you’re in the intelligence business (or even halfway intelligent), you should be able to figure that out.
And you cannot ever count on all the parties involved to keep things to themselves. In this case, the email equivalent of a catfight broke out, and that was the cause of the denouement.
[NOTE: And although it's probably true that in the olden days generals didn't encounter women quite as often, they certainly encountered them. So the opportunity has long been there, as well as the old-fashioned camp follower. And then there was the ancient "Lock up your wives!" ditty about Caesar. Sex and soldiering, not an oxymoron.]
[ADDENDUM: More details on how the email thingee worked. Petraeus and Broadwell didn't send each other emails, it turns out. They had a shared email account and could read each others' unsent drafts, thus reducing the electronic trail. My guess is that they probably would never have been caught but for Broadwell's angry emails to Jill Kelley.]