If a person comes into this Commonwealth in obedience to a summons directing him to attend and testify in this Commonwealth he shall not while in this Commonwealth pursuant to such summons be subject to arrest or the service of process, civil or criminal, in connection with matters which arose before his entrance into this Commonwealth under the summons.
If a person passes through this Commonwealth while going to another state in obedience to a summons to attend and testify in that state or while returning therefrom, he shall not while so passing through this Commonwealth be subject to arrest or the service of process, civil or criminal, in connection with matters which arose before his entrance into this Commonwealth under the summons.
Code 1950, § 19.1-277; 1960, c. 366; 1975, c. 495.