Security would be police-led but the military would make a "significant contribution", the MoD said.
Some 5,000 troops will support the police, up to 7,500 will provide venue security and 1,000 will provide logistical support.
Last week, ministers revised the Games security budget from £282m to £553m.
In addition to the 13,500 figure, there will be a 1,000-strong unarmed contingency force ready for deployment in the event of an "Olympics-related civil emergency".
The Department for Culture, Media and Sport said it now estimated 23,700 security staff would be required at Olympic and Paralympic venues next summer, more than double the original estimate of 10,000.
In a written ministerial statement, Defence Secretary Philip Hammond said that the MoD would be increasing the specialist support work during the Games that it routinely provides for the civilian authorities - such as bomb disposal, building search teams and specialist sniffer dogs.
In addition to the 5,000 personnel allocated to that role, some 3,500 would provide venue security.
This figure would rise to 7,500 on peak days during the Olympic Games, he said.
The MoD said the servicemen and women would be on hand across the UK to protect 150 venues and training sites.
And as part of the military's Olympic security role, the Royal Navy's HMS Ocean and HMS Bulwark will also be based at Greenwich, in London, and Weymouth Bay, in Dorset, respectively.
Mr Hammond told the BBC that the Games were "the biggest security challenge this country has faced for decades".
But he added that military deployment during Olympic Games was routine since the 1996 Atlanta Olympics.
"This defence contribution is on a similar scale to that deployed at other recent Olympic Games and will contribute to ensuring a safe, secure and enjoyable 2012 Olympics," he said.
"Defence will continue to be able to support current and contingent operations during the Games and my priority will remain the troops we have deployed on operations, including in Afghanistan, before, during and after the Olympics."
Philip Hammond: "They will add resilience and robustness to what will be a civilian-led operation"
Mr Hammond also said the military would split its role into two areas.
"First of all we will be providing the routine military aid to the civil power - helping and supporting the police, with things like special forces, bomb disposal capability, military search capability.
"And then we'll be supplying up to 7,500 men and women to support the guarding of the venues themselves.
"They'll be working with civilians in mixed teams, searching and checking people going into the stadiums, making sure - airline style - that nothing that shouldn't get in there gets in."
The defence secretary also said the military would be using its full range of capabilities and equipment to "keep London safe during the Olympics".
He added: "Military hardware will be used, we'll be deploying helicopters, we'll be deploying Typhoon fighters to defend London's airspace, we'll be deploying ground-to-air missile systems."
Lord Dannatt, a former head of the British Army who used to advise the Conservative Party on defence matters, believes service personnel will be pleased to be involved with the Olympics.
"It's not like Afghanistan," he said. "That's been a rolling operation for a long time, 10,000 soldiers there for six months at a time.
"This is going to be a relatively short deployment and I think, as Philip Hammond said, the soldiers, sailors, airmen and marines who are involved actually will be... I think very proud to be part of this spectacular, once-in-a-generation operation to showcase London and showcase the UK."
Conservative MP Patrick Mercer, a former officer in the British army, said the move underlined the importance of having sufficient military capacity to fulfil unforeseen tasks.
He told the BBC: "We have a limited number of police officers. You can't necessarily employ close protection officers or other security officers in this role.
"But it makes me wonder why we continue to talk about reducing the armed forces, particularly in terms of manpower, when these sorts of tasks come up at relatively short notice."
Labour's shadow defence minister, Russell Brown, said: "There can be no compromise with security at the Olympic Games and we support the deployment of UK troops.
"The British people will want to know everything possible is being done to protect their safety.
"It is important we know where these troops will be drawn from and whether there will be any impact on ongoing international efforts."
this makes me twitchy. civil deployment of miltary assets is a dodgy thing. i would be intrested to see what kind of miltary pressnes there were at the sydney and athens games...