I read a verse...about king Saul committing suicide at the hands of the phillistines. I'm wondering if there's anything that defends his situation.
The Midrash Rabbah (Noach 34:13) says אך להביא את החונק עצמו, יכול כשאול, ת"ל אך--in other words, the prohibition of suicide does not apply in the case of King Saul. Although the Midrash does not explain why the prohibition does not apply to the case of Saul, the simplest explanation would be fear of torture. This is the view cited in the Otzar ha-Geonim explaining the Gemara which says that Chananyah, Mishael and Azaryah would have succumbed to torture--the Otzar ha-Geonim explains that this does not mean that they would have been permitted to violate the prohibition against idolatry, but that they would have been forced to commit suicide so as to end the suffering: לאו למימרא שהיה להן להחיות עצמן ולעבוד ע"ז, אלא שהיה להם להרוג עצמן כאשר עשה שאול (quoted here). This is also the view of the Ramban (in Torat ha-Adam, cited ibid.):
וכן מצינו בגדול שאִבד עצמו לדעת מפני האונס, כגון שאול מלך ישראל שאִבד עצמו, אלא שהיה אִבוד מותר לו, כדאמרינן בבראשית רבה אך את דמכם לנפשותיכם אדרוש מיד נפשותיכם אדרוש את דמכם, יכול אפילו נרדף כשאול, ת"ל אך.
I don't have sources at the moment, but I seem to recall that some explain that Saul had specific license to kill himself because of he would have been captured, a tremendous chillul Hashem would have followed. (Remember Samson's torture at the hand of the Philistines; something like that happening to the king of Israel would have been very bad)