Isn't suicide illegal though? Doesn't that stop people?

Whether it is legal or not makes no difference to someone who is in such distress that they are trying to kill themselves. You can't legislate against emotional pain so making it illegal doesn't stop people in distress from feeling suicidal.

It is likely to merely isolate them further, particularly since the vast majority of attempts are unsuccessful, leaving the attemptor in a worse state than before if they're now a criminal as well.

In some countries and states it is still illegal, in other places it's not. In New Zealand the law was changed in 1961 so that it is not illegal.