One option is for him to plead insanity. I would think that you could easily argue that witnessing your children die would be sufficient enough to cause some kind of acute stress reaction that resulted in a dissociative state in which you were not really conscious of your actions or caused your thinking to be so disorganized that you didn't know what you were doing was wrongful (e.g., "I saw my kids die, and then I just kind of went into a shock, like I not inside my body anymore - I was just kind floating above it, watching things happen. I don't even remember grabbing my gun, pulling the trigger, or hearing the shots. I was just kind of numb, I guess - just there but not really there"). If his insanity defense is successful, then he will be adjudicated not guilty by reason of insanity and avoid prison. (As an aside, he could be committed to a psychiatric facility for a period of observation as well as treatment. But that's not prison.)
Another option would be for his attorney to get him a favorable plea bargain. Like Ben intimated, the prosecutor on this case may be willing to "go a little easy," realizing the circumstances surrounding the event. Maybe the prosecutor agrees to a plea deal in which the defendant pleads guilty to a lesser offense - like Reckless Homicide or something - and, in return, the defendant gets time served (as, in all likelihood, he'll be in jail a while awaiting the proceedings) and has to comply with treatment (e.g., counseling).
A third option is to proceed to trial and beat the case straight up. Here things like the "just world hypothesis" (i.e., the inherent tendency of people to think that people get what they deserve) and jury nullification (i.e., when a jury disregards the letter of the law and in an act of morality opts to find a defendant not guilty when the evidence would suggest that the defendant is not guilty) come into play.
/copy pasta (for Ben)