It is often an attempt to exert control over a life they feel like they no longer have control over. As others have said it if often not rational to us, but in their mind, if they decide to do it, if they can't control how the live, they can at least control the how and when they die.
I'd advise you both to seek professional mental health, as it's stressing you clearly as well as her. Often there are signs ahead of time, but not always. Getting affairs in order, giving away possessions, making amends to those they hurt, and sometimes a sudden increase in mood (they have something to look forward in a sense). But, as everyone is unique, a depressed person may not show any of those, and a triggering event (loss of job/relationship etc) may trigger an attempt in someone not previously thought to be at risk.
Also, look into mobile crisis counseling services in your area. I know of several states/areas that have 24/7 trained counselors that can come to you if you are in crisis and considering self harm. Folks are sometimes hesitant to call EMS or police, but there are options. Know that if they have taken something, or could be violent, etc. that you need to call 911 immediately. If a person is truly suicidal, they are not always concerned with being arrested/consequences of their actions (they think they will be gone) and anyone preventing them from completing their goal *can* be at risk. In my area it would be a joint police/EMS response, as PD has the ability to compel treatment if someone is a danger to themselves and for scene safety, but I can also sedate the person to minimize combativeness and their risk of harm to both self and others.
Again, none of this replaces licensed mental health counseling, and you should both seek it (and anyone else that finds themselves in a similar scenario)