WASHINGTON — President Trump on Monday denounced the suspected chemical weapons attack that killed dozens of people in Syria over the weekend as “atrocious,” and said he will make a decision in the next 24 to 48 hours about whether to retaliate militarily as he did to a similar assault last year.

“It was atrocious. It was horrible,” Mr. Trump told reporters at the start of a Cabinet meeting. “This is about humanity and it can’t be allowed to happen.”

Addressing Syria’s patrons in Moscow and Tehran, Mr. Trump added: “If it’s the Russians, if it’s Syria, if it’s Iran, if it’s all of them together, we’ll figure it out.”

The challenge for Mr. Trump’s Middle East policy came on a day when he was already facing a transition in his foreign policy team as his new national security adviser, John R. Bolton, arrived for his first day on the job and the president was scheduled to host the nation’s senior military leaders for dinner at the White House.

Mr. Trump insisted on Sunday that there would be a “big price to pay” for the attack, and national security and military officers were meeting on Monday to discuss options. Defense Secretary Jim Mattis, speaking with reporters on Monday, sounded a muted tone but left open the possibility that American forces would take action as they did a year ago after a similar chemical attack in Syria.

“The first thing we have to look at is why are chemical weapons still being used at all when Russia was the framework guarantor of removing all the chemical weapons,” Mr. Mattis said as he hosted the visiting emir of Qatar at the Pentagon. “And so, working with our allies and partners from NATO to Qatar and elsewhere, we are going to address this issue.”

Asked if he would rule out airstrikes against the government of President Bashar al-Assad, Mr. Mattis said, “I don’t rule out anything right now.”

Two Arleigh Burke class guided-missile destroyers are located in the Sixth Fleet’s area of operations in the Mediterranean Sea and would be able to get within striking range within hours to days. When Mr. Trump ordered the retaliatory strike against Syria for a chemical weapons attack at almost the exact same time last year, it was carried out by two destroyers firing 59 Tomahawk cruise missiles.

The already tense situation was further inflamed early Monday morning by an attack reportedly conducted by Israel on a Syrian air base used by Iranian-backed militias. The strike killed about 14 people, according to a conflict monitoring group, and Russia and Syria said it was carried out by Israel, whose government declined to confirm its involvement.

The chemical attack in the suburb of Douma over the weekend killed at least 49 people and raised the temperature of an already simmering relationship between the United States and Russia. The Moscow government of President Vladimir V. Putin has troops in Syria propping up Mr. Assad’s government. Russia has rejected the conclusion that Syria’s military was behind the chemical attack, asserting that it was staged by militants to falsely blame the government and justify an American strike against Mr. Assad’s regime.

Foreign Minister Sergei V. Lavrov told reporters in Moscow that despite Mr. Trump’s comments last week that he wanted to withdraw American troops from Syria, the United States was actually seeking to entrench itself in the country. “The U.S. is taking steps not to leave as President Trump said, and leave Syria for others, but to establish a foothold there for a very long time,” Mr. Lavrov said.

The Syria attack presented Mr. Bolton with his first crisis even as he was moving into his West Wing office. Known as a national security hawk, Mr. Bolton has in the past urged military action against governments in Iran and North Korea to counter their nuclear weapons programs, and he remains a staunch defender of the 2003 invasion of Iraq to topple Saddam Hussein.

But like Mr. Trump, he resisted a strike against Syria when President Barack Obama was in office and facing a similar choice following a chemical weapons attack against civilians in 2013. In that instance, Mr. Obama sought support from Congress, but ultimately backed off a strike after reaching an agreement with Russia to remove Syria’s chemical weapons arsenal.

“If I were a member of Congress, I would vote against an authorization to use force here,” Mr. Bolton said at the time. “I don’t think it’s in America’s interest. I don’t think we should in effect take sides in the Syrian conflict.”

Mr. Bolton took a different position when Mr. Trump ordered action last year. “I think the Trump decision to strike as they did was the correct decision,” he said then. “I think the limited, very precise nature of what the president did and the basis on which he did it was important.” He added: “I think there is an American national interest in preventing people from violating treaties that try to restrict the use or the spread of weapons of mass destruction.”