AL HAFRIYA, Iraq—Mahmoud al-Sayed’s wheat farm just south of Baghdad is hundreds of miles from the nearest front line with Islamic State, but has become a crucial part of the war effort.

The government hopes the farm and others like it in the country’s south can fill a gaping food deficit created by Islamic State’s takeover of three northern provinces that produce about one-third of Iraq’s grain.

So...