On Thomas Aquinas' view of natural law, law is written into the fabric of the universe. On one level, everything that happens is part of divine law, since God's plan of providence includes every single event that happens across all time. Aquinas calls this eternal law. On a second level, certain things are good for us or bad for us according to our nature, according to what kind of thing we are and what would make for contributing to our welfare and the internal purpose within us as organisms and as God's creations. That's the natural law. Then human beings can issue legitimate rules that fit with what's best for us and seek the general welfare. If it meets all these criteria, then it's a human law. If it's issued by someone without care for those it includes or if it's not for the general good or reasonable, then it's a real law. Otherwise, it's just a rule. He's got high standards for when a purported human law really is a law.
One of the aspects of this that I hadn't seen until this summer, when I covered a more extensive part of his treatment of this in what's called the Treatise of Law (but is really just a section of the Summa Theologiae, and he gave it no such title) is that he also allows for custom to generate laws. When he introduces the notion of legitimate authority to make laws, he says there are two ways this can happen. One way is that someone (singular or plural) God has placed in care over a group issues a rule that really is for the common good. The other way is that people issue a regulation over themselves. In contemporary times, we hear that and think he's talking about democracy. He surely knew of the ancient democracies, since he education would have included quite a bit about the ancient world. But that turns out not to be his primary concern when he says this. He actually means custom.
We have lots of rules by custom rather than by what we ordinarily call law. I'm pretty sure there were men's and women's restrooms before there were any laws about who can go in which in public buildings. If I'm wrong, there are lots of examples that are like that. It's not illegal in the U.S. to call people ordinary insults, but it's often immoral, and it's against custom if it's a certain kind of insult or a certain kind of context (in the middle of a job interview, say). We as a society have standards not to do things that aren't illegal. They're just frowned on, and you get ostracized or socially penalized if you do them.
What I found interesting about Aquinas on this subject is that he thinks this can go the other way too. If a certain action is worth prohibiting for the common good and is made a law (a genuine law) but then becomes against the common good, what was a law becomes merely a rule. But what about when no one follows a law, and those in authority tolerate such behavior? The movie theater in the mall near us hasn't allowed backpacks in the theater since a little after the September 11 terrorist attacks in 2001. At least that's their official policy. But no one enforces it, and lots of people don't keep it. I think Aquinas would see that as custom determining what the real human law is, and I think that's a very interesting view. It also has implications for speed limit laws in a jurisdiction where the police don't stop people for going 5 over or 10 over, and everyone drives that fast because they know where the threshold for being stopped is. On Aquinas' view, it's as if the law really is where they practice it as being, not where it's written to be. (Of course, all this depends on the custom's practice being consistent with the common good. If not, then custom couldn't modify written law in this sort of way.)