Yes. And measles is so contagious and deadly that the only way to protect those groups is by vaccinating enough other people. This is why measles vaccines have been such a huge focus for the past 50+ years.
And that is also why antivaxxers are directly responsible. Their willful ignorance and self-entitlement exposes these vulnerable groups to harm.