While there are nuances to it, most laws today violate rights. Government and law regulate many or most aspects of trade, business and everyday life. As a practising lawyer one is hired in to represent a range of businesses and individuals. In the case that the objective is to defend the individual or company from Government claims, or as a plaintiff against Government, either it be in criminal or civil law, it is morally consistent to defend the individual or company. However, many legal disputes are of the civil kind where businesses meet individuals, businesses meet businesses or individuals meet individuals.
Let's assume the laws in the following cases violate rights, i.e. they would not exist in the ideal Objectivist laissez-faire system.
In the case that one's client is the defendant, I think it is a moral practise of the lawyer. This is basically due to the fact that one then is helping the defendant to avoid laws to be enforced onto the defendant, laws which ultimately are threats of coercive violence and a coercion that is not the result of that the defendant has infrigned the plaintiff's individual rights.
However, in the case of being the plaintiff, one is trying to make sure the defendant is effectively bowing to these threats of coercion. Is this moral?
I agree with FCH, but I figured I'd put it as an answer rather than a comment, even though the substance is the same (I hate to see those unanswered questions! ;-)
Yes, it is immoral to be an accessory to a rights violation.
Note, also the related problem (which I think raises its ugly head much more frequently) of asserting a valid law frivolously. I believe this is also immoral.
Also, it sounded like you thought only plaintiffs' attorneys or government prosecutors were susceptible to wielding rights violating laws to the detriment of others; that anything a defense attorney did was essentially okay because they were defending someone from coercive government power (if I am wrong on that, please correct me). Note that there are many rights-violating laws that can be asserted as a defense by defendants---I'll give you two examples out of many possibilities: first, defendants accused of infringing a patent very often assert the defense that the patent is invalid because it violates the anti-trust laws (which are obviously horrendous laws); second, in modern contract law many perfectly valid contracts will be nullified because the parties had unequal "bargaining power." In such cases a person with a legitimate claim will not be compensated because a bad law was used by a defendant. This to me is just as bad as a plaintiff wielding bad law on the offensive, because a harmed individual has a right to redress of his injuries, and that redress has been thwarted by bad law.
As for FCH's musings about a law that would violate one party's rights if not asserted, but would also violate the other party's rights if it is asserted, I cannot think of any real laws that do so (I can think of laws that are unfair to both parties, but that is not the same thing). An imaginary law that might fit the bill would be any law that requires a party to assert a bad claim against another party or suffer a penalty themselves. For example, in the realm of anti-trust, one could easily imagine a law requiring a party who knows about potentially collusive behavior to initiate a lawsuit charging an anti-trust violation based on that behavior, or be charged as an accessory if they don't (essentially this would conscript citizens into helping the government enforce the unjust law or be persecuted themselves).