I have no idea when the phrase actually appeared, but I'm guessing it was during a time where condoms were less frequently used and STDs were running wild. If you're not using protection and you have sex with people who also never used protection, then yeah, you could be sleeping with everyone that person ever slept with, in the sense that you could contract all sorts of lovely diseases that have been passed down the chain. But I'd like to think most people are smarter than that. Of course, there are STDs that are asymptomatic, so people could pass the disease on unknowingly, as well.