What are the consequences if I fail to appear in court?
It depends on whether you were legally required (i.e., subpoenaed) to appear in court or not. If you were not subpoenaed, there will be no consequences. But you were subpoenaed, you can be punished for ignoring legal process and be held in contempt of court.
Before addressing what could happen to a witness, including the "complaining witness" or victim in a criminal case, let's touch on what happens in a civil case (a lawsuit) if one of the parties (person suing, or person being sued) fails to show up for a court date. If a party to a civil matter fails to appear, then in the vast majority of cases, he or she will lose the case. The way each party loses is technically different, but it's still "losing" the case. If the plaintiff (person suing) doesn't show, the court will "dismiss" his or her case--basically end it. The plaintiff may be able to re-file a new case later, but at the least, he or she will lose time and money due to the dismissal. If the defendant (person being sued) doesn't show, he or she will "default" and the court will give the plaintiff what the plaintiff was asking for--typically, that means ordering the defendant to pay money.
As to what happens to a witness, the answer depends upon whether you were subpoenaed to appear or not. A subpoena is an official legal process. It is backed up by the power of the court system. If you received a subpoena to appear but failed to do so, you violated legal process--something equivalent to a court order--and therefore may be punished by the court. This is called being held in "contempt of court" and may involve being fined or even being jailed. However, if you were simply "asked" to appear but were not subpoenaed, then there was no legal compulsion to show up for court and you cannot be punished for failing to show up. So whether or not you were subpoenaed answers the question of whether you will suffer consequences for your failure to appear.
However, that's not the end of the matter. If you were an important or critical witness, the case will often be adjourned (delayed) to another date, to provide an opportunity to issue a subpoena to you. This is especially true in criminal cases, including criminal cases in municipal court (e.g., disorderly person's offenses, such as if someone harassed or shoved or punched you), if the witness who failed to show is the victim of the crime or "complaining witness." Since the victim's testimony is generally critical to the case, the judge will typically adjourn the case to a later date so the prosecutor can subpoena the witness to appear--at which point the witness will have to appear, on pain of punishment if he or she does not. Therefore, simply not appearing usually accomplishes nothing, except to delay matters by 2 - 4 weeks to allow for the issuance of a subpoena.
Don't think that you can show up but refuse to testify. The law only allows you to refuse to testify if your testimony would incriminate you--that is, potentially help put you personally in jail. You can't refuse to testify for other reasons (i.e., you don't want to see the defendant jailed).
And do not think you can simply change your story and lie on the witness stand. If you do and are found out, you will have committed perjury, a crime, and could be jailed.
In short, if asked to appear in court and testify, do so, because one way or another, now or later (after being subpoenaed), you will have to do this.