The commanding officer upon any occasion of duty may place under arrest during the continuance thereof any person who shall trespass upon the camp ground, parade ground, armory, or other place devoted to such duty, shall in any way or manner interrupt or molest the orderly discharge of duty by those under arms, or shall disturb or prevent the orderly passage of troops going to or returning from any such duty.