Washington said US companies were evacuating hundreds of staff from a major air base north of Baghdad as the militants battled security forces just 80 kilometres (50 miles) from city limits.
With militants closing in on the capital, forces from Iraq's autonomous Kurdish region took control of a swathe of territory they have sought to rule for decades against the objections of successive governments in Baghdad.
Obama said Iraq was going to need "more help from the United States and from the international community" to strengthen security forces that Washington spent billions of dollars in training and equipping before withdrawing its own troops in 2011.
Read: US pulled back into fires of Iraq War
"Our national security team is looking at all the options... I don't rule out anything," he said.
The interior ministry said security forces had adopted a new security plan for the capital to protect it from the advancing militants.
"The plan consists of intensifying the deployment of forces, and increasing intelligence efforts and the use of technology such as (observation) balloons and cameras and other equipment," ministry spokesman Brigadier General Saad Maan told AFP.
"We have been in a war with terrorism for a while, and today the situation is exceptional."
Militants outside shrine city
Militants were gathering Friday for a new attempt to take the city of Samarra, home to a revered Shiite shrine whose 2006 bombing sparked a sectarian war, witnesses said.
Iraqi families sit outside their tents a temporary camp set up to shelter Iraqis fleeing violence in Iraq's northern Nineveh province, in Aski kalak, 40 kms West of Arbil, in the autonomous Kurdistan region. Thousands of people who fled Iraq's second city of Mosul after it was overrun by jihadists wait in the blistering heat, hoping to enter the safety of the nearby Kurdish region and furious at Baghdad's failure to help them. (AFP Photo)
Witnesses in the Dur area, between militant-held Tikrit and Samarra, said they saw "countless" vehicles carrying gunmen south during the night.
Residents of Samarra, just 110 kilometres (70 miles) north of the capital, said gunmen were gathering to the north, east and southeast of the city.
A tribal leader said militants had approached the security forces in the city, asking them to leave peacefully and promising not to harm the Al-Askari shrine.
Read: Terror attacks in Iraq, Pakistan, Nigeria highlight changing face of al Qaeda threat
But security forces had refused, he said.
Militants already mounted two assaults on Samarra, one on Wednesday and one late last week, which were thwarted after heavy fighting.
The Al-Askari shrine was bombed by militants in February 2006, sparking sectarian conflict between Iraq's Shiite majority and Sunni Arab minority that left tens of thousands dead.
The militants, who have swept up a huge swathe of predominantly Sunni Arab territory in northern and north-central Iraq since launching their offensive in second city Mosul late Monday, advanced into ethnically divided Diyala province.
On Friday, they were fighting pro-government forces near Muqdadiyah, just 80 kilometres (50 miles) from Baghdad city limits.
Kurds step into breach
Diyala's mixed Arab, Kurdish, Sunni and Shiite population has made the province a byword for violence ever since the overthrow of Sunni Arab dictator Saddam Hussein in the US-led invasion of 2003.
Kurdish security forces moved into the strategic Saadiyah and Jalawla districts of the province overnight after the army withdrew, Deputy Governor Furat al-Tamimi said.
Kurdish forces already took control of the ethnically divided northern oil city of Kirkuk on Thursday when central government troops pulled out.
It has been the fulfilment of a decades-old Kurdish ambition, opposed by successive governments in Baghdad, to expand their autonomous region in the north to incorporate a swathe of historically Kurdish-majority territory across northern and north-central Iraq.
Watch video: Iraq needs more US help says Obama
Prime Minister Nuri al-Maliki's government has been left floundering by the speed of the jehadist assault.
The swift collapse of Baghdad's control comes on top of the loss of Fallujah, west of Baghdad, earlier this year. It has been a blow for Western governments that have paid a steep price both in lives and money in Iraq.
Washington mulls drone strikes
Washington is considering several options for offering military assistance to Baghdad, including drone strikes, a US official told AFP on condition of anonymity.
Resorting to the unmanned aircraft -- used in Afghanistan, Pakistan and Yemen in a highly controversial programme -- would mark a dramatic shift in the US engagement in Iraq, after the last American troops pulled out in late 2011.
An Iraqi security officer stands guard as Iraqi civilians wait to volunteer to join the fight against a major offensive by jihadists in northern Iraq, in the central Shiite Muslim shrine city of Najaf. (AFP Photo)
But there is no current plan to send ground troops back into Iraq, where around 4,500 American soldiers died during the conflict.
US companies were evacuating "a few hundred" American contractors working with the Iraqi government from Balad air base, 70 kilometres (43 miles) north of the capital, a US defence official said.
The contractors "are being temporarily relocated by their companies due to security concerns in the area," State Department spokeswoman Jen Psaki said.
Obama's Republican opponents were swift to accuse the president of abandoning Iraq by pulling out US troops in 2011.
Senator Lindsey Graham warned a jehadist takeover in both Iraq and neighbouring Syria would create a "hell on earth" and called for the urgent deployment of US air power to "change the battlefield equation."