The short answer is yes you can lock your classroom doors as long as the following regulations are met.
Should colleges have clasroom doors that lock.
First you comply with title 8 cal osha on emergency egress single action exits meaning you cannot be required to put a key in the lock to unlock the door to escape during a fire.
See figure b with this function teachers do not have to enter the hallway to lock the classroom door.
However if a school has doors that have deadbolts or similar locks there are situations where a locked door can for example prevent egress in an emergency.
Classroom door security locking hardware the ability to protect students and teachers while in the classroom is a high priority in all educational institutions.
See figure a in response to school shooting concerns a new function was designed called a classroom security function door locks with this function can change their locked or unlocked status on both the outside or inside of the classroom but still only through the use of a key.
Many doors that do not have hardware that allows teachers to lock it from inside the classroom can be locked by turning a thumb turn or by pushing a button on the door.
The vast majority of school doors can remain locked from the outside while still having a handle release on the inside mainly due to building or fire codes.