All of those three examples have different courses of action based on what their intent is, though. Catching too many fish is provable, touching places that are inappropriate for washing a child is ... harder to show, but provable. The medical marijuana example is regulated by prescription and if you don't have a prescription it's illegal. My question is "how the heck do you prove motive here?" Guess it based on the fact that they had a ultrasound determining the gender? That seems pretty circumstantial. Witchhunt them by asking other people if that's what they did? C'mon. I just don't see how that sort of law is realistically enforceable unless you just outright don't allow people with ultrasounds to determine gender to get abortions.
If the people are smart, you don't.
But you might be surprised how many people you catch by asking them "so why do you want an abortion?"
As a fun anecdote, my first PS2 burned out when Elfboy and I were playing...probably a bunch of FFT and a bunch of...some PS2 game (Shadow Hearts 2 maybe?) so it was running for about 8 hours in a row. I called up and they asked me if I had ever used a gameshark or anything with it, and I answered yes. Turns out using a gameshark at any point invalidates the warranty.
Also, if you look at Kohlberg's theory of moral development, there's a significant portion of the population that believes that following the law means that you are acting morally. Which means there are people whom, if it was illegal to get an abortion based on gender/LGBT status of the fetus, wouldn't get the abortion...even if they knew that the law was unenforceable and that they could just lie about their reasons for abortion.
I mean yeah, you're not going to get much more effective than a sign on the lawn saying "please don't step on the grass" but such measures aren't -completely- ineffectual.