The Ruling on Teaching in Mixed Schools
Question :
Is the teacher who teaches in a mixed section of boys and girls, or only girls but they are in their teens guilty of sin, if he looks at them?
Answer:
It is incumbent upon a man to avert his gaze from looking at women; Allah, Most High says:
"Tell the believing men to lower their gaze (from looking at forbidden things), and protect their private parts (from illegal sexual acts). That is purer for them. Verily, Allah is All-Aware of what they do."
and Imams Muslim, Abu Dawud and others reported on the authority of Jarir bin 'Abdullah, may Allah be pleased with him, that he said: "I asked the Messenger of Allah about an inadvertent look (at a woman) and he said:
"Avert your eyes."
The wording is that of Abu Dawud. Mixing of males and females is not permissible in education, because it leads to the occurrence of immoral acts between them.
Source:
The Permanent Committee
Fatawa Islamiyah, Vol. 5 Pages 164-165