When a court shall have entered any of the orders provided for in § 19.2-168.1, 19.2-169.1, 19.2-169.5, or 19.2-169.6, the sheriff of the county or city or the proper officer of the penal institution shall immediately proceed to ascertain whether a vacancy exists at the proper facility or hospital and until it is ascertained that there is a vacancy such person shall be kept in the jail of such county or city or in such custody as the court may order, or in the penal institution in which he is confined, until there is room in such facility or hospital. Any person whose care and custody is herein provided for shall be taken to and from the facility or hospital to which he was committed by an officer of the penal institution having custody of him, or by the sheriff of the county or city whose court issued the order of commitment, and the expenses incurred in such removals shall be paid by such penal institution, county or city.
Va. Code § 19.2-178