If a person passes through this State while going to another State in obedience to a subpoena or order to attend and testify in that State or while returning therefrom, he shall not while so passing through this State be subject to arrest or the service of process, civil or criminal, in connection with matters which arose before his entrance into this State under the subpoena or order.
Ca. Pen. Code § 1334.5