Most legal jobs are countercyclical. This means that when the economy is bad, these jobs expereince growth and there is an increase in demand for them. Lawyers are a good example of a countercyclical labor market. For example, when the economy is down, crime rises so there is an increase in demand for judges, prosecutors, public defenders and other defense attorneys. On the civil side, demand increases for bankruptcy and foreclosure lawyers. As long as the economy avoids stagflation, even real estate lawyers would expereince a boom (assuming interest rates fall, which would likely happen in recession).
Obviously, you could point to some examples of areas where lawyers demand mimics the overall economy, but the trick is to diversify your practice so you can perform well in any market. Large firms will be unaffected by changing economic conditions because their practice areas are vastly diversified.
So, the bottom line is that generally legal services jobs are countercylical in part because our business involves fixing what went wrong, usually involving economic or social distress.