A prosecution may not require you to give evidence at a trial. If the evidence is not contentious, the prosecution and defence can agree for evidence to be submitted to the court in written form.
If you are required to appear in court you will normally receive a summons with a date. If you live a long distance from the court or are unwell, it may be possible to give evidence by video. Inform the prosecutor as soon as possible so they can make a special application to the court for this to happen.
The New Zealand Law Society’s Giving Evidence guide has more information.