While refusing to testify
can be contempt of court, there are certain situations where you can legitimately refuse to comply with a subpoena:
Privilege
Attorney-client privilege protects an attorney from being
compelled to testify to attorney-client communications. Doctor-patient confidentiality
prevents a doctor from testifying to a patient's private medical information without the patient's consent. Marital communications privilege protects a spouse from having to
testify to communications with the other spouse that occurred during a marriage.
Fifth Amendment
Under the Fifth Amendment, you
can refuse to testify to self-incriminating evidence. This will only work if the testimony can incriminate you. If you've received immunity from prosecution, however, the Fifth Amendment will not protect you if you refuse to testify.
So, if you've been subpoenaed and do not want to testify, consult with a experienced criminal defense attorney to see if any of these privileges apply to you, or you could face jail time if you don't show up.