If someone is doing the wrong thing, you have to rebuke him (Lev.19:17).
It is like the duty you have to save a person from danger. If you can see that they are stepping into obvious risk, you cannot stand idly by.
The same applies to a person who is breaking a law of the Torah: if you refrain from speaking out, you have a share in the responsibility for the risk they are taking with their eternal life.
It is not only their wellbeing which you are protecting, but your own. If you ignore actual or possible evil around you, you show yourself as a hard-hearted, irresponsible citizen.
What about a situation in which no-one is going to take any notice of your warning or rebuke?
For the sake of your own conscience you cannot remain unmoved, but you might make a laughing stock of yourself. Hence the sages say, “Just as it is a duty to say that which will be heeded, so it is a duty not to say that which will not be heeded” (Talmud Yevamot 65b).