If it appears by affidavit that the testimony of a person is material in any criminal proceeding, and if it is shown that it may become impracticable to secure his presence by subpoena, a committing magistrate or court shall impose conditions of release upon him pursuant to §§ 23A-43-2 and 23A-43-3. No material witness shall be detained because of his inability to comply with any condition of release if his testimony can adequately be secured by deposition, and further detention is not necessary to prevent a failure of justice, but his release may be delayed for a reasonable period of time until his deposition can be taken pursuant to chapter 23A-12.
SDCL 23A-43-18