A subpoena will be issued directing a witness to appear in court on a specific day and time for the purpose of testifying. If a witness refuses to appear after the subpoena is delivered, the prosecutor will ask that a warrant (called “an attachment”) be issued for the witness's arrest and confinement in jail until the witness testifies.
Willful failure to obey a lawful order of a court, such as a subpoena, is an act of contempt for which the witness may be punished by the court. After all of that, a witness will still have to testify. A witness must testify truthfully. False testimony as to important facts while under oath in an official proceeding (such as a trial) is a very serious felony offense.