The teacher refused (ES) to let her take the test since her headscarf covered her ears, which could be used to cheat as it could hide electronic equipment.
Via Bikya Masr (h/t Islamophobia Watch):
A 14-year-old Muslim girl in Spain was kicked out of an exam in her Madrid secondary school after she refused to take off her headscarf, local Spanish newspaper 20 Minutos reported on Tuesday night.
Eivan Khemins Eibar, the girl’s lawyer and a specialist on discrimination cases, sent a report to the school manager saying the student did not do anything wrong in wearing the higab.
(source)