Obviously this varies between jurisdictions, but I don't think any jurisdiction would consider you an accomplice for something you had no knowledge of.
However, some jurisdictions make it a (completely separate) crime to not notify the authorities of certain planned or commited crimes that you are aware of, and of course depending on the nature of the crime the police might believe that anyone travelling together with the perpetrator must have been actively involved.
So while you may not actually have done anything illegal, you're quite likely to be considered a suspect, which (in case of a serious crime) can cause you all kinds of trouble, and with a corrupt or incompetent police force, can land you in prison regardless.