Answered by Shaykh Faraz Rabbani
If one is teaching a classroom filled with male and female youths that belong to Muslim parents, it would be permissible to teach them, regardless if one or two of them were adults but not wearing hijab?

Walaikum assalam,
I pray this finds you in the best of health and spirits.
This follows the ruling of commanding the good and forbidding the wrong. The essential purpose of commanding the good and forbidding the evil is to increase the good, and reduce wrong.
As such, it must be done after clear thinking and proper assessment of the situation, and possible outcomes. Until reasonably sure that one’s words or actions will be of benefit (the least of which would be to affirm the truth, even if it is not heeded), and bereft of harm, one should not act. The scholars deduce this from the Prophet’s words (Allah bless him and give him peace), “Whoever believes in Allah and the Last Day, let him say what is good or remain silent.” [Bukhari and Muslim]
Imam Nawawi (Allah have mercy on him) said,
“Every legally responsible person should refrain from saying anything except when there is a clear advantage to speaking. Whenever speaking and not speaking are of equal benefit, it is sunna to remain silent, for permissible speech easily leads to that which is unlawful or offensive, as actually happens much or even most of the time – and there is no substitute for safety. The Prophet (Allah) bless him and give him peace) said,
“Whoever believes in Allah and the Last Day, let him say what is good or remain silent.”
This hadith, whose authenticity Bukhari and Muslim concur upon, is an explicit legal text indicating that a person should not speak unless what he intends to say is good, meaning that the benefit of it is apparent to him. Whenever one doubts that there is a clear advantage, one should not speak. Imam Shafi`i (Allah have mercy on him) said, “When one wishes to speak, one must first reflect, and if there is a clear interest to be served by speaking, one speaks, while if one doubts it, one remains silent until the advantage becomes apparent.” [Nawawi, al-Adhkar, as translated by Shaykh Nuh Keller, Reliance of the Traveller, r.1.1]
Faraz Rabbani