Stupid law, but federalism dictates that, unless the federal or state constitution bars the local government from legislating in that area, they are free to do so.
No matter what you think of the law, the city is well within its rights. There's probably a good reason for the ordinance regulating house occupancy and it may or may not have been designed to put down unmarried couples. What is fact is that, in this town, you have to be a related, legal family to live more than three to a house. These two, knowing the law, have decided not to get married, despite the risk that poses to their three children, and are now asking that a town not enforce one of its laws simply because they want to enjoy all the privileges of marriage (like raising children) without actually signing on to a committment. I think it's pretty selfish of them.
Now, maybe the law is stupid, but if that's the case, there's no reason to try to overturn it with yet another BS judicial fiat. Instead, they should move just outside the city limits and lobby to have the city council overturn the law. If they don't, and if the people don't speak out to make them, it's their problem.
On a side note, I think its the height of selfishness and self-indulgence to try to raise three children without the stabilizing force of a marriage to hold the family together.