it would say it depends on how mentally ill one is. depression seems to cover a huge area, anywhere from "the blues" because your girlfriend left you, deep psychological pains that manifest also in physical ways and pain. the same could be said of some other disorders (or whatever we're calling them these days). the first type of depression and those closer to it, of course can be treated with meditation, the dhamma etc, since these are the "simple' dukkha of life itself as it is for all of us. now mental illness on the extreme end of the spectrum, personally shouldn't just be left up to one to just meditate or study, but rather should be handled by a professional. I've personally known people who after severe emotional trauma were told by monks that they need to stop meditation since during meditation all sorts of odd things were happening, thing normally equated with the insane (it's hard to talk about here due to invading another person's privacy). so there is no easy yes or no answer to this question, can some people be helped yes, can other be made worse. yes.
i should also add, that a long term or experienced yogi may be better at using meditation to help themselves versus an inexperienced one. those of us who have been around the cushion for years may be better at working through things that a newbie going through some type of off cushion psychological problem may have real problems with.
สัพเพ สัตตา สุขีตา โหนตุ
the mountain may be heavy in and of itself, but if you're not trying to carry it it's not heavy to you- Ajaan Suwat