I haven't been able to reach a definite conclusion on whether or not the court was justified in concluding that the witness was likely to fail to appear on the second day of the preliminary hearing. Apparently, the prosecutor informed the judge that there was reason to believe the witness would not return, and so requested her detention. It's not clear what that was based on, or how carefully the court examined the evidence.

It is clear that, even if the woman's detention was justified, (the Criminal Code permits it but, as you clearly suspect, it is VERY rare) the conditions of it were not. She should not have been transported in the same vehicle as the accused, and there does not seem to have been any reason for the shackles (apparently, at least one sheriff agreed, as the shackles were not always used).