"Members of the parliament authorised the government to grant Iranian citizenship to the wife, children and parents of foreign martyrs who died on a mission... during the Iran-Iraq war (1980-1988) and afterwards," it said.
Citizenship must be awarded "within a maximum period of one year after the request", IRNA added.
Iran's outgoing conservative-dominated parliament will serve until late May.
No figures are available on the number of foreign fighters killed during the Iran-Iraq war, but Afghans, and even a group of Iraqis, fought alongside Iranian forces against the regime of Saddam Hussein.
Signup to our newsletter and follow us on Facebook and Twitter!
The law could apply to "volunteers" from Afghanistan and Pakistan who are fighting in Syria and Iraq against jihadists including the Islamic State group and Al-Nusra Front.
Shiite Iran is a staunch supporter of Syrian President Bashar al-Assad and provides financial and military support to his regime.
Tehran says its Fatemiyoun Brigade, comprised of Afghan recruits, are volunteers defending sacred Shiite sites in Syria and Iraq against Sunni extremists like those of IS.
The Islamic republic denies having any boots on the ground and insists its commanders and generals act as "military advisers" in Syria and Iraq.
Iranian media regularly report on the death of Afghan and Pakistani volunteers in Syria and Iraq, whose bodies are buried in Iran. More than three million Afghans live in Iran, one million as legal migrants.