Federal Bureau of Investigation Director James Comey warned of a potential consequence of a future Islamic State defeat in the Middle East: a migration of the group’s fighters to Western Europe and the U.S.

In a speech at Fordham University on Wednesday, Mr. Comey said counterterrorism officials are focused on the prospect of hundreds of Islamic State fighters surviving the battlefield and flowing into Western Europe to commit attacks like the recent ones in Brussels and Paris. The ease of travel would also make the U.S. vulnerable...