BAGHDAD—The meeting with the world’s most wanted man took place at a secret location in the barren hinterland of eastern Syria, at the heart of Islamic State’s shrinking realm.

The gaunt, ailing figure who entered the long hall with bricked-up windows in May 2017 was a shadow of the man hailed as a modern-day caliph by his thousands of followers as they waged war in Iraq and Syria, fracturing those two nations and drawing the U.S. and its allies into protracted Middle East conflicts.