She came to her senses when she was taken to the hospital.

Literal

She [topic-は] hospital [to-に] was-taken when [at-に] sanity [to-に] returned.

正気にかえる ('to return to sanity/consciousness') is a set expression. 連れていかれた is the passive of 連れていく ('to take someone').