For months, intelligence officials had kept Mr. Trump apprised of what he had set as a top priority, the hunt for Mr. al-Baghdadi, the world’s most wanted terrorist.

But Mr. Trump’s abrupt withdrawal order three weeks ago disrupted the meticulous planning underway and forced Pentagon officials to speed up the plan for the risky night raid before their ability to control troops, spies and reconnaissance aircraft disappeared with the pullout, the officials said.

Mr. al-Baghdadi’s death in the raid on Saturday, they said, occurred largely in spite of, and not because of, Mr. Trump’s actions.

It is unclear how much Mr. Trump considered the intelligence on Mr. al-Baghdadi’s location when he made the surprise decision to withdraw the American troops during a telephone call on Oct. 6 with President Recep Tayyip Erdogan of Turkey. What is clear, military officials said, is that it put commanders on the ground under even more pressure to carry out the complicated operation.