Whenever a prisoner is admitted to a hospital or facility for the care and treatment of individuals with mental illness, the Director may order the transfer of the prisoner to any other willing hospital or facility for the care and treatment of individuals with mental illness, and such other hospital or facility is authorized to admit such prisoner under the authority of the commitment order applicable to the hospital or facility from which such prisoner was transferred. No such transfer shall alter any right of a prisoner under the provisions of this article nor shall such transfer divest a judge or court, before which a hearing or request therefor is pending, of jurisdiction to conduct such hearing.
Va. Code § 53.1-40.5