I'm not talking about jailing but if you economically invest in something that is unethical you should expect to lose money as an outcome (possibly the whole investment).
That is to say, if mutual funds (which your 401k likely comprises) stand to lose significantly to unethical behavior, then they will be a LOT more choosy about who to invest in.
Your argument to the extreme about jailing parents/teachers is missing my discussion point.
But how can shareholders know? Let's say I bought some shares of VW before this scandal. Unless I'm an automotive engineer and have access to test equipment and access to all models of the cars that have the fraudulent software on them, how can I possibly know that something unethical is going on? Even if I did meet all of those requirements, how would I be able to tell whether it was a bug vs. an intentional attempt to defraud the government? What if my government doesn't have those requirements? I don't see how it's even remotely possible for most shareholders to have this information.
The funds will require disclosure and risk-aversion behavior of their portfolio companies and in general not turn a blind eye to the possibility of unethical behavior.
It's not deterministic but it does create a positive feedback loop of ethics compliance.