Impossible to give a more accurate answer with some more detail re the nature of the health problems but at a very high level do law firms take mitigating circumstances into account? Yes they do.
Whether and how much that helps is going to depend entirely on the individual situation - firms will take different approaches and may take these factors into account depending on the severity and nature. You'd need to explain how and why the health conditions affected your grades for that period, and how you did your best at the time in the circumstances.
Worth also noting that working in large law firms is by most standards a tough demanding job involving plenty of resilience so you'd also want to be demonstrating how the health problems wouldn't affect your ability to work going forwards.