If a witness refuses to testify in a legal case, they may be subject to penalties and sanctions for contempt of court. Contempt of court is a charge that can be levied against individuals who disobey a court order or refuse to comply with a court subpoena.
Witnesses may have valid reasons for refusing to testify, such as fear of retaliation or concerns about self-incrimination. However, in most cases, witnesses are legally obligated to appear in court and to provide truthful testimony.
The judge may also issue a bench warrant for their arrest, or they may be held in contempt of court and face fines or even imprisonment. In some cases, the witness may be granted immunity from prosecution in exchange for their testimony, which means their testimony cannot be used against them in a criminal case.