Hi Lisa
I would say no. Using 'class' in the teaching context a class could be a group of students, or it could be the course they are attending, or it could even be the actual teaching session, but not used as a synonym for the classroom, which is the actual physical room in which the class is being held.
So, if you say 'the pupils are in class', it does not refer to the room, just to the fact that they are attending a taught session.