Thursday's announcement by the International Olympic Committee was the fruit of negotiations between the Lausanne-based organisation and the kingdom's sports chief and has been hailed as a "breakthrough."
It capped weeks of suspense and won praise for Saudi Arabia from IOC President Jacques Rogge.
The women who will make history for Saudi Arabia are Wodjan Ali Seraj Abdulrahim Shahrkhani (judo) and Sarah Attar (800m).
"This is very positive news and we will be delighted to welcome these two athletes in London in a few weeks' time," Rogge said.
"The IOC has been working very closely with the Saudi Arabian Olympic Committee and I am pleased to see that our continued dialogue has come to fruition."
Saudi sports authorities have refrained from promoting the participation of women athletes in the London Games, apparently to avoid run-ins with ultra-conservative forces opposed to such an initiative.
In early July the Saudi Olympic committee chairman and sports minister, Prince Nawaf bin Faisal, set out the rules of the game.
All women competitors must dress modestly, be accompanied by a male guardian and not mix with men during the Games, he told Al-Jazirah newspaper.
Saudi sportswomen may only take part if they do so "wearing suitable clothing that complies with sharia" (Islamic law) and "the athlete's guardian agrees and attends with her," he said.
"There must also be no mixing with men during the Games."
Saudi Arabia, Qatar and Brunei have been the only three countries yet to send women athletes to the Olympics. And now all three will be represented from July 27 in London.
Qatari female shooter Bahiya al-Hamad will carry Doha's flag at the opening ceremony.
The 19-year-old Qatari, who will compete in the 10 metres pistol event, was elated.
"I am shaking with joy to be carrying the national flag of my country, Qatar, at the opening ceremony," said Hamad. "It is an historic moment for sport."
And Attar, 17, speaking from her training base in the US city of San Diego, said: "It's such a huge honour and I hope that it can really make some big strides for women over there to get more involved in sport."
Unlike Saudi Arabia, Qatar encourages female sports and is determined to host the Olympics in 2024 even if its bid for 2020 failed. It is also preparing to host the 2022 World Cup.
-- 'Policy changes needed' --
Thursday's announcement was hailed by Human Rights Watch (HRW) as a "breakthrough for Saudi women's sports."
"Allowing women to compete under the Saudi flag in the London Games will set an important precedent," said Christoph Wilcke, senior Middle East researcher at the New York-based organisation.
"But without policy changes to allow women and girls to play sports and compete within the kingdom, little can change for millions of women and girls deprived of sporting opportunities."
The sporting world and activists for women's rights had held their breath for weeks as they awaited news from Saudi Arabia and the Olympics committee on the participation of the female athletes.
Hopes were shattered when the International Equestrian Federation (FEI) last month announced that Saudi female rider Dalma Rushdi Malhas failed to qualify for the London Games.
Malhas, 20, had been aiming to achieve the minimum eligibility standard required by the June 17 deadline, but her horse was sidelined by injury and missed a month's work during the qualifying period.
There was further suspense when Prince Nawaf laid down stringent conditions that had to be met if Saudi women were to be part of the Olympics, triggering fears that organisers would turn him down.
On Thursday, the IOC stopped short of saying under what conditions exactly the Saudi athletes will compete.
HRW quoted a popular Saudi cleric, Dr Mohammad al-Arifi, who is said to have more than two million followers on Twitter, warning Prince Nawaf last November about sending female athletes to London.
"'Women practising sports... is fundamentally allowed... but if this leads to mixing with men... or revealing private parts... or men watching her sometimes run, sometimes fall down... sometimes laugh and sometimes cry or quarrel with another female athlete... or mount a horse... or practise gymnastics... or wrestling... or other sports... while the cameras film and the channels broadcast... then there can be no doubt that it is forbidden,'" he ruled, the watchdog said.
Saudi Arabia forbids public displays of female sports, and state television is banned from airing tennis matches in which women compete -- even if they can be seen on satellite television across the kingdom.
Earlier this month a decision by world footballing authorities to overturn a ban on women soccer players wearing the Islamic headscarf was welcomed by several Arab states, but Saudi Arabia stayed mum on the decision.