Yes, it is possible.
There are reasons why writers may be prone to depression. For one, being familiar with misery, pain, and suffering may guide the process for some writers. Yes, writers can write about suffering even if they don’t know it intimately, but some may feel that their work will lack authenticity if they haven’t experienced the same trials and tribulations as their characters on some level.
Writing is also a solitary pursuit. The lack of social interaction can set the stage for depression. If you are isolating yourself and don’t get outside much, you are likely not exercising or getting natural light.
The writing life can also be an emotional roller coaster if you’re constantly faced with rejection from editors, agents, publishers, or even peers. A large part of a writer’s success depends on how other people think of him or approve.
Most writers are lone wolves. You write on your own and may not interact with others. You may also write late into the night or even only at night. This can throw off sleep-wake schedules, which also may increase the chances of depression. Lack of sleep, exercise, natural light, and company can be a recipe for depression.