If a witness comes into this state in obedience to a summons directing him to attend and testify in this state he shall not while in this state pursuant to such summons 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 the summons.
SDCL 23A-14-22