If you have married, you have a commitment to join families together and stay together and raise children. In most cases, if you do this outside of marriage, you run the risk of unwanted pregnancy. Especially in the old days - birth control is a modern invention, but even now it's not infallible and often misused or not used. Creating another human being and leaving a mother to care for it (who is now dishonored at least in old time society's eyes is NOT a nice thing to do (either to the new human being or the mother). The commitment seems like a reasonable thing to ask for, given the outcome of the action, vs the selfishness of engaging in it and leaving someone else to 'clean up the mess', emotionally at the bare minimum. I haven't even touched on disease transmittal.
Most people do ignore this rule; but it is there for good reasons and there consequences to breaking it, some of them very severe which can impact innocent lives, or lead to a female aborting a pregnancy. There's a lot less mess and pain downstream if the rule is followed. Most rules are there for our benefit.