Where a writ of habeas corpus is granted in proceedings involving the custody of a person not held under judicial process, the court shall have discretion to make a proper order concerning the temporary custody of such person pending final determination of the proceeding or pending appeal and may, as a condition of such order, require from the person granted such custody security, through bond or otherwise, for the production of such person at such time and place as the court orders, and for the safety and well-being of such person during such temporary custody.
SDCL 21-27-25