In economics, your opportunity cost for any given thing that you do is the value of the other things that you could have done if you hadn't chosen to do what you did. If I choose to go to see a movie, for example, the opportunity cost is that I could have spent my time and money on something else. Those other things that I didn't do with that time and money are my opportunity cost.
In the case of Atticus, the most obvious answer is that he could have taken some other case or cases if he had not defended Tom Robinson. If there were other cases he could have taken or other people he could have been working for, that would be the opportunity cost of his decision to defend Robinson.
However, we might also imagine that Atticus could have lost future business by defending Robinson. Perhaps some white people might dislike the fact that Atticus did that and refuse to hire him in the future. If that happened, you could say that was an additional opportunity cost of his decision to defend Robinson.