It depends on how the policy is written:

"Many life insurance policies, just like any other insurance coverage, come with certain exclusions that null and void any benefits should you expire in a certain way, i.e., suicide. However, there can be fine print attached to that exclusion. Some policies will pay benefits even if the policyholder committed suicide, but the policyholder would have had to committed suicide after holding the life insurance policy for two to three years depending on the carrier."

"Some policies come with a separate exclusion that addresses non-disclosure of mental health and/or drug or alcohol addiction/dependencies. If you have a history of serious depression and your life insurance carrier doesn’t know, you run the risk of eliminating any benefits if you commit suicide. Leaving out information like this allows insurance companies to deny benefits based on a contestability clause."

http://www.insurancequotes.org/life/the-truth-about-suicide-life-insurance/