Although it may seem strange, antidepressants are sometimes prescribed for sleeping problems because many people who are stressed out or depressed whether temporarily or chronically have trouble sleeping at night. So, the two problems often go together and are treated simultaneously. It's important to realize that insomnia is not a disorder that just happens in most cases. Usually, something sets it off. That something could be temporary, such as cramming for an exam, a death in the family or another stressful event.