Even if rarely prosecuted — the laws against bastardy being an example of laws that seem to have had only a handful of prosecutions over a few hundred years — the mere fact that they are illegal establishes a clear warning to all that such things are close to unacceptable in a functioning society.
I fully agree.