In prison seemed more safe than taking part in aeriel dogfighting and bombardments, but prison presents it's own dangers.
Unless you are a member of a prison gang, you're a walking carcass in a room full of hungry vultures. Your only safety is solitary confinement if your cell-mate is untrustworthy. You're amongst the worst of criminals, if not the worst, who are serving life sentences. The beds probably aren't comfortable, the food is just good enough for consumption, and you don't get to shower by yourself. Your everyday life is controlled by a routine schedule.
The dangers include being beaten to death, stabbed, and **ped, which can happen as soon as you let your guard down, or when you least expect it.
Being a military pilot on the other hand, whether you are a fighter pilot or a bomber pilot, your quality of life is a bit better. Yes, you face all the dangers of aeriel warfare which includes risk getting blown up by anti-aircraft artillary, missiles, torn to shreds by high explosive bullets, but it's not all the time.
Depending on the kind of war you're in, generally it is often said that war is 99 percent of boredom and 1% of sheer terror. Assuming that you're fighting an enemy that has an equal or greater strength to your own (a conventional war), if your side can achieve air dominance then not only the dangers for you is greatly diminnished but the war can soon be over and won.
Unlike being or becoming an inmate in prison, you're highly trained in your respective job. YOu're trained not just shoot down other planes or bomb targets but survive every existing threat. If you have an incoming missile for example, you know how to use countermeasures such as flares and chaffs, as well as jammers. Not only that, evade them effectively, but timing is important.
With that said, you also risk fighting an unjust war. imagine risking your life for a government that wanted to annex other countries merely to gain more power ahd influence. If so, you've become the "Bad Guy" even though you're just doing your job. And military member must follow orders... one just can't leave because you think you're fighting the wrong war.
Still, to be sentenced to 10-15 years you must have done something to deserve it which makes you much more of a bad guy than any of military members unless you're wrongly convicted... then you'll be wrongly punished..