If any person subpoenaed as a witness in any case or matter, shall refuse to be sworn or affirmed, or to give evidence, he shall be committed to prison by the court, justice, master, commissioner, referee, or other person authorized to take his testimony, there to remain without bail until he shall be sworn or affirmed or shall give his evidence.