At about year 22 into it, I began to work two days a week with homeless, mentally ill persons in downtown Dallas. That was a new-to-me level of suffering and drama. The learning process began again, but, again, I just kept doing the work and one day I could fully empathize with someone who'd lost two grandchildren that month in two different drive by shootings while I was with her, and then let it go and move on to the next one.
Again, I am pretty sure that it is an unconscious mechanism, supported by peer or supervisory support for really disturbing situations. But even then, you process the situation and then get back to the work. That's how you learn to "leave it at the office."