Such a situation is dealt with in Section 350 and 349 of Cr.P.C. The failure to attend the court may be due to valid and just reasons or may be deliberate.
If the failure to attend the court after receiving summons as witness is due to just and excusable reasons, the court can excuse the non-attendance.
However, if the witness without any just excuse neglect or refuse to attend the court on the given day and time, the court may deem it as an offence and try him by summary procedure and give him opportunity to show cause as to why he should not be punished.
Depending upon his response, the court can sentence him. However, there is no provision for imprisonment, only fine can be imposed. The maximum fine which can be imposed is Rs.100/-.
However, as per Section 349, if a person has been called by the court to produce any document or thing and fails to produce the same on the given day and time and does not given any excusable explanation for such failure, the court may sentence him for up to 7 days. If he produce the thing in the meanwhile, he is released from custody. However, if he still persists with refusal, he may be tried under Section 345 or 346 of Cr.P.C.