If you have been called to be a witness in a trial, you may voluntarily agree to attend the trial and give evidence. If you do not voluntarily agree, you may receive a legal notice such as a subpoena or notice to attend trial. If you receive a legal notice to attend trial as a witness, you must comply with the notice. If you fail to comply, the judge may issue a warrant for your arrest. In extreme cases, the judge may order you to be placed in custody to ensure that you attend court.
Bear in mind that if you are a witness at a trial, you cannot refuse to answer a question on the grounds that the answer will incriminate you or reveal your guilt. Canadians have a constitutional right against self-incrimination, so if, while testifying, you say something that incriminates you, that evidence cannot be used against you in any legal proceeding. This protection applies, however, only to what you say while on the witness stand.