Normally they shouldn't leave their workplace but they can "forget" it if you assign them while there's an incident going on or you revive them during incident etc. etc. It is normal for workers to wander around the room if their production is complete but they get right back to work after you collect the resource.
Actually my wife mentioned the same thing to me last night, she had a few that she put into a room when there was no incident happening and later found them wondering the room with space still in that room which they had left