The criminal code allows a judge to jail a witness only if they fail to appear when subpoenaed or otherwise refuse to take the oath or to testify.

The criminal code does NOT allow a judge to jail a witness for any reason.

It seems obvious to me that we don't give judges a broad power to jail witnesses because if we did, then people would be very reluctant to come forward with evidence.  For that matter, it could even be argued that a witness anxious to be released from jail might feel compelled to say whatever the Crown wants and it could taint their testimony.