Of course suicide is a sin but can you pray for death if you think you will be saving others from fitnah as well as yourself by praying for death. For example if you see no alternative which does not include a fitnah.
Imam Bukhari relates that the Prophet (s) said, “No one of you should wish for death. Either he is a doer of good and will do more, or he is a doer of evil but perhaps he may stop.”
It was narrated from Abu Hurayrah (r) that the Prophet (s) said, “No one of you should wish for death or pray for it before it comes, for when one of you dies, his good deeds come to an end and for the believer a long life will not increase him in anything but good.” (Sahih Muslim)