"I believe we will be fighting this generational struggle for the rest of my political lifetime," Cameron said.
"We face in ISIL (IS) a new threat that is single-minded, determined and unflinching in pursuit of its objectives," Cameron wrote in the Sunday Telegraph.
"We are in the middle of a generational struggle against a poisonous and extremist ideology," Cameron said, adding that Islamic State fighters sweeping across Syria and Iraq are a direct threat to the UK.
"Already it controls not just thousands of minds, but thousands of square miles of territory, sweeping aside much of the boundary between Iraq and Syria to carve out its so-called caliphate," he said.
Cameron also expressed his concern over the Islamic State terrorist movement, saying "If we do not act to stem the onslaught of this exceptionally dangerous terrorist movement, it will only grow stronger until it can target us on the streets of Britain."
However, he said he did not think British troops should be deployed in Iraq and he would consider working with Iran to combat the threat.
"We must work with countries like Saudi Arabia and Qatar, the UAE, Egypt and Turkey against these extremist forces, and perhaps even with Iran, which could choose this moment to engage with the international community against this shared threat," said Cameron.
IS has seized large parts of northern Iraq and Syria over the summer.
Kurdish forces, supported by US air strikes, are currently battling to retake Mosul dam from IS fighters in northern Iraq.
There are also continuing reports of massacres of non-Muslims by the extreme Sunni group, which is seeking to build a new Islamic state spanning Iraq and Syria.
It is estimated the group has up to 400 recruits from the UK, and some 69 people suspected of Syria-related jihadist activities have now been arrested in the UK.
In late June this year, IS declared that it had created an Islamic state, stretching from Aleppo in Syria to the province of Diyala in Iraq.
IS-led violence has so far driven an estimated 1.2 million Iraqis from their homes.