Will the foreign key constraint throw an error while restoring a database?
Depending on the type of backup, that can indeed happen. It's therefore recommended to disable foreign key checks before the restore, e.g. with

SET FOREIGN_KEY_CHECKS=0;


and re-enabling them afterwards with

SET FOREIGN_KEY_CHECKS=1;


This has another advantage: MySQL won't check the foreign key for every single imported record, but for all records at once. This will speed up your restore.

See Disabling foreign key checks on the command line on Stack Overflow.