ISTANBUL—Syrian rebels backed by U.S. airstrikes and Turkish artillery were struggling Friday to seize the last stretch of the Turkey-Syria border held by Islamic State while a militant counteroffensive triggered a mass exodus.

American officials and aid groups said Islamic State had pushed U.S.-backed fighters from key towns and sent families fleeing camps that the extremist group had briefly captured.

The...