What law is James talking about? The law of love. Gal 5:14 says, "All the law is summed up in this one word: love." Jesus said, "Upon loving God and loving our neighbor hang all the law and the prophets (see Mat 22:40). So here James is saying, "Don't speak evil of any brother or sister. If you do that, you're not obedient to the law of love."