The foreigners were part of more than 160 fighters of the Maute group of militants who came under attack last weekend in Mindanao island, said national military chief General Eduardo Ano.
"We inflicted about 37 enemy killed, 14 have been identified and 23 still unidentified, with three Indonesians and one Malaysian," he told reporters in Manila.
It was unclear how he arrived at the death toll.
Lieutenant Colonel Jo-ar Herrera, spokesman for the brigade which led the assault in the town of Piagapo in Lanao del Sur province, said soldiers had recovered only three bodies but informants and local residents had reported a far higher death toll among the extremists.
More From This Section
Ano said the foreigners were former members of the Southeast Asian militant group Jemaah Islamiyah, which carried out the 2002 bombings in the Indonesian holiday island of Bali.
Jemaah Islamiyah has long had a presence in the southern Philippines and has trained locals in such skills as bomb- making.
The military, using FA-50 jets, helicopter gunships, bomber planes and artillery, attacked and eventually captured the Maute camp which covered three to four hectares (seven to 10 acres).
The Maute group has "IS aspirations" and was seeking to be recognised by the jihadist movement which has conquered swathes of Iraq and Syria, Herrera said.
Troops are still hunting for more than 100 members who fled to the hills, he added.
The Maute group is just one of several Muslim armed bands in the strife-torn southern Philippines whose leaders have pledged allegiance to IS.
The group has been linked to bombings and kidnappings and has launched several large-scale assaults on local communities.