From what I can tell, the original reason for making non-marital sex taboo was the following:
1. Before birth control, and in societies where property was handed down from father to son, you needed a way to be certain that your wife's kids were, in fact, your own. If she'd never slept with anybody else, then you knew your stuff was in fact going to your kids.
2. If you were a pregnant woman, and the father of your child left you, you were screwed in both the literal and figurative sense, as women in many early cultures weren't allowed to own property and only had access to one profession--the world's oldest. (This is also why Jewish prophets are recorded as saying a LOT about giving to widows--if you were a woman and didn't have a husband, you had NOTHING.) If you were married to the father of your children, then he was automatically guaranteed to take responsibility, as they were now legally part of his family in addition to being blood offspring.
3. In the days when marriage was a financial transaction, a deflowered woman was considered less valuable than a virgin, partly for the reasons above, and partly because the system of inheritance in place at the time was so strongly dependent on controlling women. If you could discourage premarital sex, and marry your daughters off young, then all the males in the arrangement benefited, and your daughters weren't left on the streets.
Naturally, the modern combination of readily-available birth control and higher ages at first marriage have made the need for a premarital sex taboo obsolete, which explains why our culture's attitudes toward premarital sex have changed so dramatically over the past 50 years or so.