The men, all Azeri nationals, "were trained in Islamic State training camps in 2012-2015 and took part in fighting in Syria and Iraq within the ranks of terrorist groups," the national security ministry said in a statement.
Fighting in foreign wars is a criminal offence in the predominantly Muslim but secular country of more than 9 million people.
Local media had previously reported numerous cases of Azerbaijani nationals fighting alongside jihadists in Syria and Iraq, including within the ranks of the Jaish al-Muhajireen wal Ansar group consisting mostly of Islamists from the former Soviet Union.
Around 25,000 foreign fighters from more than 100 countries are involved in armed conflicts worldwide, with the highest numbers in Syria, Iraq and increasingly Libya, according to United Nations.