Fire drills are used both to test equipment (alarms, sensors, fire department notification) and practice evacuating calmly and quickly. It isn't really about training through repetition. A visitor to your school who has never heard the alarm or practiced the fastest egress route will still be able to leave safely in the event of an actual fire — because there will be an audible alarm and marked exit routes.
An old but significant example of the importance of advance warning is the Triangle Shirtwaist Factory fire, which led to 146 deaths. While numerous factors led to the high fatality rate, failure to quickly inform workers of the danger certainly contributed:
A bookkeeper on the eighth floor was able to warn employees on the
tenth floor via telephone, but there was no audible alarm and no way
to contact staff on the ninth floor. According to survivor Yetta
Lubitz, the first warning of the fire on the ninth floor arrived at
the same time as the fire itself.
—Wikipedia, Triangle Shirtwaist Factory fire
So, buildings such as workplaces and schools are now required to have functional fire detection and warning systems, and to have a plan for ensuring prompt, calm evacuation of occupants. A drill tests that the equipment is working properly and demonstrates that there's an evacuation plan in place.
A few regulation examples:
You must have a fire detection and warning system.... You must carry
out regular checks... You need to train new staff when they start
work and tell all employees about any new fire risks. You should
carry out at least one fire drill per year and record the results. You
must keep the results as part of your fire safety and evacuation plan.
—UK Government, Fire Safety in the Workplace
For an alarm system to be effective, you must have an emergency action
plan that addresses how employees, including disabled workers, will be
informed that an emergency exists and how they should respond. The
alarm system must inform all affected employees that an emergency
exists and what their immediate response should be based on the alarm
sequence.
—OSHA Emergency Standards, Employee Alarm Systems
The employer shall assure that a test of the reliability and adequacy
of non-supervised employee alarm systems is made every two months.
—OSHA Fire Protection Regulations, section 1910.165(d)(1)
Of course, it doesn't do much good if managers demand staff keep working even when an alarm is going off. The purpose having alarms is so warning is given as early as possible so there is time to get out. Having a drill does provide practice, but it also tests the evacuation plan and the detection/alarm equipment, which is more critical to safety.