The Shulchan Arukh rules on yichud (seclusion with women) and related prohibitions of physical and social proximity between men and women. A male teacher in a girls' class must address whether the setting violates yichud or related prohibitions.
להתרחק מן העריות. ובו ז סעיפים: צריך אדם להתרחק מהנשים מאד מאד ואסור לקרוץ בידיו או ברגליו ולרמוז בעיניו לאחד מהעריות ואסור לשחוק עמה להקל ראשו כנגדה או להביט ביופיה ואפילו להריח בבשמים שעליה אסור ואסור להסתכל בנשים שעומדות על הכביסה ואסור להסתכל בבגדי צבעונים של אשה שהוא מכירה אפי' אינם עליה שמא יבא להרהר בה. פגע אשה בשוק אסור להלך אחריה אלא רץ ומסלקה לצדדין או לאחריו ולא יעבור בפתח אשה זונה אפילו ברחוק ד' אמות והמסתכל אפילו באצבע קטנה של אשה ונתכוין ליהנות ממנה כאלו נסתכל בבית התורף (פי' ערוה) שלה ואסור לשמוע קול ערוה או לראות שערה והמתכוין לאחד מאלו הדברים מכין אותו מכת מרדות ואלו הדברים אסורים גם בחייבי לאוין: אסור להשתמש באשה כלל בין גדולה בין קטנה בין שפחה בין משוחררת שמא יבא לידי הרהור עבירה באיזה שמוש אמרו ברחיצת פניו ידיו ורגליו אפי' ליצוק לו מים לרחוץ פניו ידיו ורגליו אפילו אינה נוגעת בו והצעת המטה בפניו ומזיגת הכוס: הגה וי"א דה"ה באכילה עמה בקערה נמי אסור בכל ערוה כמו באשתו נדה (בנימין זאב סימן קמ"ג) ויש מקילין בכל אלו דלא אסרו דברים של חבה אלא באשתו נדה (רשב"א אלף קמ"ח) וי"א דכל זה אינו אסור רק במקום ייחוד אבל במקום שרוב בני אדם מצויים כגון במרחץ מותר לרחוץ מכותית שפחות וכן נוהגים (מרדכי פ' אע"פ בשם הר"ש בר ברוך וי"א דכל שאינו עושה דרך חבה רק כוונתו לשם שמים מותר לכן נהגו להקל בדברים אלו (תוספות סוף קדושין) י"א דאין לנהוג אפילו עם אשתו בדברים של חבה כגון לעיין ברישיה אם יש לו כנים בפני אחרים (נ"י פרק חזקת הבתים):
A person must stay very far from women. He is forbidden to signal with his hands or his feet, or to hint with his eyes, to one of the arayos. He is forbidden to be playful with her, to be frivolous in front of her, or to look upon her beauty. Even to smell the perfume upon her is forbidden. He is forbidden to gaze at women doing laundry. He is forbidden to gaze at the colorful garments of a woman whom he recognizes, even if she is not wearing them, lest he come to have [forbidden] thoughts about her. If one encounters a woman in the marketplace, he is forbidden to walk behind her, but rather [must] run so that she is beside or behind him. One may not pass by the door of a promiscuous woman [or: a prostitute], even four cubits [around 6–8 ft or 2–2.5 m] distant. If one gazes even at the little finger of a woman with the intent to have pleasure from it, it is as though he gazed at her shameful place. It is forbidden to listen to the voice of an erva or to look at her hair. If one intentionally does one of these things, we give him lashes of rebellion. These things are also forbidden in the case of ordinary Biblical prohibitions. It is forbidden to be served by a woman at all, whether she is an adult or a minor, whether a slave or free, lest he come to have forbidden thoughts. What service were they speaking of? Washing his face, hands, and feet, even to pour water so he can wash his face, hands, and feet, even if she does not touch him; or making his bed in front of him; or pouring a drink. Rem"a: Some say that eating with her with a bowl is also forbidden with every erva, as with his menstrually impure wife. There are those who are lenient in all of this, that they only prohibited affectionate things with one's menstrually impure wife. Some say that all this is forbidden only when they are alone, but in a place like a bathhouse where many people are found, one may be washed by an idolatrous slave woman, and this is the custom. And some say that anything not done in a affectionate manner (בדרך חבה), where his intent is only for Heaven's sake, is permitted. Thus the custom is to be lenient in these things. Some say that one should not do affectionate things even with his wife, such as to inspect her head for lice, in front of others.)