Flight Lieutenant Malcolm Kendall-Smith, 37, disobeyed an order to return to the Gulf, where he had served twice previously, because he believed military action there was illegal under international law.
The medic, who has dual British-New Zealand citizenship, had argued to a panel of five RAF officers in Aldershot, southeast England, that he thought the US-led invasion of Iraq in March 2003 was "on a par with Nazi Germany".
It was the first court martial of its kind in Britain over the Iraq war.
Passing sentence, Judge Advocate Jack Bayliss said the offences were so serious that only custody was appropriate and would send a strong message to others thinking of similar action.
"Obedience of orders is at the heart of any disciplined force. Disobedience of orders means it is not a disciplined force, it is a disorganised rabble," he told him.
"Those who wear the Queen's uniform cannot pick and choose which orders they obey and those who do so must face the consequences."
He added: "You have, in this court's view, sought to make a martyr of yourself. You have shown a degree of arrogance that is amazing."
Kendall-Smith's lawyer, Justin Hugheston-Roberts, said afterwards that his client had given him "very clear and unambiguous instructions to lodge an appeal with all haste".
The medic was "clearly upset yet resilient", Hughestone-Roberts added, but told reporters: "Now more than ever, he (Kendall-Smith) feels his actions were totally justified and he would not, if placed in the same circumstances, seek to do anything differently."
For its part, the RAF said only that it supported the ruling that the orders given to Kendall-Smith were lawful and therefore should have been followed.
Kendall-Smith's case attracted the interest of anti-war campaigners, who claimed his views merely reflected a growing body of opinion across Britain that the war was illegal and unjustified.
Stop the War Coalition convenor Lindsey German described the sentence as "an absolute outrage" and said the group would support Kendall-Smith's appeal.
"We know there are many other servicemen and women who feel like he does. I'm sure this sentence is aimed at deterrring them because the Ministry of Defence must know that his views are just the tip of the iceberg," she said.
Kendall-Smith faced five charges related to his failure to attend pre-deployment instruction in small arms weapons handling and helmet fitting, a training course and briefing plus the deployment to Basra, southern Iraq, in June last year.
The doctor, based at RAF Kinloss in northeast Scotland and described by his lawyer in court as "a man of great moral courage", had denied the charges.
The prosecution dismissed his claims about the illegality of the war as irrelevant, stating that at the time of the offences, coalition forces were legally in Iraq at the request of country's democratically-elected government.
