There are tons of jobs that require a person to be frequently coming into contact with death and difficult situations. Law enforcement, first responder, medical personnel, nursing home worker, home care worker, counselor, social worker, clergy, attorney who works in any sort of family law/ elder law/ estate planning, funeral director, coroner, cemetery worker, teachers who deal with troubled students, etc.
To the extent that mental health issues are caused by chemical imbalances or other physical issues, then you’re going to see the same percentage of mental health issues across all professions. To the extent that mental health issues are caused or made worse by dealing with death and difficult situations, people who can’t handle that stuff would be likely to self-select out of the profession. Most of the above careers have a fairly long training path and a lot of opportunities for someone to decide to opt out before they get committed to a particular path.
As someone said, life is difficult and death/ illness/ tragedy is unfortunately a part of life. I would think the priest has some advantage if his own faith is strong, because that will provide him with some coping strategy.