If a vaccine is 100 percent effective, there is no justification for mandatory vaccination. Anyone who wishes to be protected can voluntarily take the vaccine. It would not be possible for someone declining the vaccine to harm someone who voluntarily takes the vaccine. Any call for a mandatory vaccine is an explicit admission that the vaccine is not 100 percent effective.
If a vaccine were 0 percent effective, there would be no justification for anyone taking the vaccine. There must be some intermediate percentage of effectiveness that maximizes the utility of mandatory vaccination. As the vaccine becomes more effective, fewer people can possibly benefit from mandatory vaccination. As the vaccine becomes less effective, a lower percentage of people who could possibly benefit from mandatory vaccination will actually benefit.