Va. Code Ann. § 18.2-61.1
A. As soon as practicable following arrest, the attorney for the Commonwealth may request after consultation with a complaining witness, or shall request upon the request of the complaining witness, that any person charged with (i) any crime involving sexual assault pursuant to this article; (ii) any offense against children as prohibited by §§ 18.2-361, 18.2-366, 18.2-370, and 18.2-370.1; or (iii) any assault and battery, and where the complaining witness was exposed to body fluids of the person so charged in a manner that may, according to the then-current guidelines of the Centers for Disease Control and Prevention, transmit a sexually transmitted infection, be requested to submit to diagnostic testing for sexually transmitted infections and any follow-up testing as may be medically appropriate. The person so charged shall be counseled about the meaning of the tests and about the transmission, treatment, and prevention of sexually transmitted infections.
If the person so charged refuses to submit to testing or the competency of the person to consent to testing is at issue, the court with jurisdiction of the case shall hold a hearing in a manner as provided by § 19.2-183, as soon as practicable, to determine whether there is probable cause that the individual has committed the crime with which he is charged and that the complaining witness was exposed to body fluids of the person so charged in a manner that may, according to the then-current guidelines of the Centers for Disease Control and Prevention, transmit a sexually transmitted infection. If the court finds probable cause, the court shall order the person so charged to undergo testing for sexually transmitted infections. The court may enter such an order in the absence of the person so charged if the person so charged is represented at the hearing by counsel or a guardian ad litem. The court's finding shall be without prejudice to either the Commonwealth or the person charged and shall not be evidence in any proceeding, civil or criminal. At any hearing before the court, the person so charged or his counsel may appear.
B. At any point following indictment, arrest by warrant, or service of a petition in the case of a juvenile of any crime involving sexual assault pursuant to this article or any offenses against children as prohibited by §§ 18.2-361, 18.2-366, 18.2-370, and 18.2-370.1, the attorney for the Commonwealth may request after consultation with a complaining witness, or shall request upon the request of the complaining witness, and the court shall order the defendant to submit to diagnostic testing for sexually transmitted infections within 48 hours and any follow-up testing as may be medically appropriate. Any test conducted following indictment, arrest by warrant, or service of a petition shall be in addition to such tests as may have been conducted following arrest pursuant to subsection A.
If the defendant refuses to submit to testing or the competency of the person to consent to testing is at issue, the court with jurisdiction of the case shall hold a hearing, in a manner as provided by § 19.2-183, to determine whether there is probable cause that the complaining witness was exposed to body fluids of the defendant in a manner that may, according to the then-current guidelines of the Centers for Disease Control and Prevention, transmit a sexually transmitted infection. If the court finds probable cause, the court shall order the accused to undergo testing for sexually transmitted infections. The court may enter such an order in the absence of the defendant if the defendant is represented at the hearing by counsel or a guardian ad litem. The court's finding shall be without prejudice to either the Commonwealth or the defendant and shall not be evidence in any proceeding, civil or criminal. At any hearing before the court, the defendant or his counsel may appear.
2023, cc. 680, 681.