Could this be The Cure by Sonia Levitin?
"You are a criminal, Gemm 16884--aggressive, hostile, nonconforming.
We have noted tendencies toward diversity in your gait, in your
dreams, and most especially in your repeated persistence in"--the
Elder cleared his throat--"making music."
Branded a deviant--and therefore a threat--to the utopian society of
Conformity, Harmony, and Tranquility that exists in the year 2407,
Gemm 16884 is given the choice between being recycled or undergoing a
painful and mysterious cure. Gemm chooses the cure, and suddenly finds
himself living the life of Johannes, a 16-year-old Jewish musician in
starsbourg, Germany, in 1348, at the onset of the Black Death. As the
pestilence spreads, the townspeople begin to accuse the Jews of
causing the disease. Surrounded by hatred and horror, Johannes
struggles to hold on to his family and faith as well as his belief in
the basic goodness of human beings. But can he return to the future
and become Gemm again after having known such emotions as pain. . .and
love?

Multiple reviews mention masks, twins, anti-Semitism and time travel.