Maybe people don't get prosecuted for attempted suicide, but the threat of prosecution is made to force the person into psychiatric treatment.
Most states don't lean on the suicide statutes for that. Typically, if the police or physicians reasonably believe that you are a danger to yourself or others, you can be involuntarily committed - no actual attempt required.