"We will be more forthright in the defence of our values, not least because a world of greater freedom is a fundamental part of how we keep our people safe," the leaders wrote in a joint editorial in the Times of London.
Their comments come as world leaders gather at a golf resort in Wales for a high-stakes NATO summit.
The official agenda will focus on the crisis in Ukraine and the drawdown of the NATO combat mission in Afghanistan, but the rise of the Islamic State group in Iraq and Syria will dominate discussions on the sidelines of the summit.
Obama and Cameron appear to suggest that NATO should play a role in containing the militants, but were not specific in what action they would seek from the alliance.
More From This Section
Cameron on Monday proposed new laws that would give police the power to seize the passports of Britons suspected of having travelled abroad to fight with terrorist groups.
The two leaders were to visit with students at a local school today morning before joining their counterparts from France, Germany and Italy to discuss the crisis in Ukraine.
Ukraine and Russia have been locked in a standoff for months, with pro-Moscow forces stirring instability in eastern Ukrainian cities. On the eve of the NATO summit, Russia and Ukraine said they were working on a deal to halt the fighting, but Western leaders expressed scepticism noting it wasn't the first attempt to end the deadly conflict.
NATO leaders are expected to agree this week on the creation of a rapid response force that would set up in nations in the alliance's eastern flank to serve as a deterrent to Russia.
"We must use our military to ensure a persistent presence in Eastern Europe, making clear to Russia that we will always uphold our Article 5 commitments to collective self-defence," Obama and Cameron wrote.
Under Article 5 of the NATO charter, an attack on one member state is viewed on an attack on the whole alliance. Obama reiterated his support for that principle Wednesday during a visit to Estonia, one of the newer NATO members set on edge by Russia's provocations.