Also, when one person commits suicide it can often prompt others to do so, usually those close to them and not all suicide attempts are legit, not saying its to get attention some are just people seeing if they can go through with it. So I think it was more of deterrent for potential suicide as opposed to punishing the people who attempt it.
tl;dr it was there to stop suicide attempts by people unsure whether they wanted to die or not by assuring death.