I hope this question is appropriate for this subreddit and I don't mean to offend anyone with it. Let's just assume that those who wrote the Bible were people in an authoritative position who used the text to influence their citizens to live a certain way. What would be the cultural or economical benefit of saving sex until marriage?
From a purely economical perspective, it allows men to be (relatively) sure whose children are whose. After all, there's a really easy way to see who the mother of a child is, but sometimes it can be quite difficult to know who the father is; and if I'm an iron-age farmer, I'll want to make sure that the children I'm taking care of are actually mine.
Ok, you might think, that's fine for adultery; but I'm talking about before marriage specifically. Well, if a woman has a child outside of marriage in these times, who will feed the child? Who takes care of it? Women usually weren't allowed to own land, and over 90% of people earned their living through agriculture, so where will the money come from? Maybe in relatively prosperous times someone will have mercy on the child, but for most of our history we humans have lived pretty bare-bones existences. So the child either starves to death, maybe turns to stealing for his food, or someone has mercy on it.
And then, what does that say about the woman? She broke this law and had a child outside of marriage, maybe she will continue sleeping with other people after she's married? Will she respect any of the laws of our society?