If a person passes through this state 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 state be subject to arrest or the service of civil or criminal process in connection with matters which arose before his entrance into this state under summons.
SDCL 23A-14-23