Speaking after the vote, Dr Walker, who is also a trained food scientist and nutritionist, said: "A little of what you fancy may do you some good, but as nearly one in four people in Scotland are obese a lack of physical activity, an unhealthy diet and larger portion sizes are clearly taking their toll on the health of Scotland.
"Chocolate has lost its status as a special treat and I think that if we charged a tax on it then, over a number of years, we could restore that status."
He had earlier told the BBC news website that obesity was a "mushrooming" problem, and Scotland risked heading the same way as the United States.
He added: "There is an explosion of obesity and the related medical conditions, like type 2 diabetes. I see chocolate as a major player in this, and I think a tax on products containing chocolate could make a real difference."
Dr Walker said that a 225g bag of chocolate sweets contained almost 1,200 calories - almost half the recommended daily calorie intake for a man - and could be eaten incredibly quickly.
He warned that many people were consuming this amount of chocolate on a daily basis, as well as their normal meals, and were unaware of the harm it was doing.
He said: "There is lots of negative publicity about other fast food and junk food but chocolate is sneaking under the radar.
"People have been lulled into a false sense of security about chocolate.
"I had one patient recently who said to me she thought chocolate was good for you. People are being brainwashed into believing this."
Under Dr Walker's proposal, presented at the annual conference of Scottish Local Medical Committees, revenue raised from taxing chocolate products would be used by the NHS to deal with the health problems caused by obesity.
He also argued that the extra money raised could be spent on increasing and improving sports facilities.
Dr Walker said: "After eating a bag of chocolate sweets you would have to walk continuously for three hours to burn off the calories consumed.
"It is simply not enough to say people should get more exercise. They also need to moderate their chocolate intake and this tax would help them do that."
But representatives from the food and drinks manufacturing industry dismissed Dr Walker's suggestion.
Julian Hunt, of the Food and Drink Federation, said: "Introducing regressive taxes on the foods that consumers love would result only in lighter wallets, not smaller waists - particularly as we already have to pay VAT on all our chocolate purchases.
"While good for grabbing headlines, there is no evidence to suggest that such 'fat taxes' would actually work in reality.
"Indeed, when the BMA debated a similar motion in 2003 its members voted against such an idea on the grounds that such a taxation policy would have no effect on obesity, would hit lower income groups hardest and would be a bureaucratic nightmare."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.