The Cabinet minister said he had received legal advice on the issue in recent days and was looking at it after becoming concerned about falling vaccination rates.
Speaking at a fringe event at the Conservative Party conference in Manchester hosted by HuffPostUK, Mr Hancock said social media companies had “a lot to answer for” for spreading anti-vaccine views.
Mr Hancock said: “We need a massive drive to get these vaccination rates back up.
“I said before that we should be open minded, and frankly, what I’d say is that when we – the state – provide services to people, then it’s a two-way street, you have got to take your responsibilities too.
“So I think there is a very strong argument for having compulsory vaccinations for children when they go to school because otherwise they are putting other children at risk.
“Now, you have got to make sure the system would work, because some children can’t be vaccinated and some may hold very strong religious convictions that you would want to take into account.
“But, frankly, the proportion of people in either of those two categories is tiny compared to the 7% or 8% now who don’t get vaccinated.
“And then I’d want to make it very easy when the children do arrive at school not vaccinated simply to get vaccinated and make it the norm.
“I think there is a very strong argument for moving to compulsory vaccination. And I think that the public would back us.
“I have received advice inside Government this week on how we might go about it and I’m looking very seriously at that.
“I am very worried about falling rates of vaccinations, especially measles. For measles the falling vaccination rates are a serious problem.
“And it’s unbelievable, I think, that Britain has lost its measles-free status, and it should be a real wake-up call.
“The worst thing is that if you don’t vaccinate your child and you can, then the person you are putting at risk is not only your own child, but it’s also the child who can’t be vaccinated for medical reasons – maybe they have got cancer so their immune system is too weak, and they are losing what’s called ‘the herd immunity’ that you get from when over 95% of people are vaccinated.”
Mr Hancock also used the fringe event to launch a strong defence of the sugar tax.
He said: “I am not proposing that we ban sugary drinks.
“But we have got to tax something.
“So, taxing things that are actively bad for you and drive up my costs in the NHS – let’s tax those things instead of taxing good things like the amount of work that people do through income tax.”