The fate of foreigners who joined Islamic State has become an increasingly urgent issue as U.S.-backed fighters prepare to capture the militant group’s last stronghold in eastern Syria.