Baden-Powell had been besieged in the town of Mafeking during the Second Boer War. He had formed the Mafeking Cadet Corps, which was a group of youths that supported the defending troops by carrying messages and similar tasks. This freed up men for military duties and kept the boys occupied during the prolonged siege.
Back in the UK, the newspapers, had followed the progress of the Siege of Mafeking. When the siege was broken, Baden-Powell became a national hero. On the back of this, people bought the small manual, Aids to Scouting, he had written some years earlier about military scouting and wilderness survival. This fuelled public interest in the subject of scouting.
When he returned to the UK, Baden-Powell became involved with the Boy's Brigade, becoming a Vice President of the organisation in 1903. This was already a large youth organisation (in 1910, there were some 100,000 boys enrolled in about 2200 companies across the British Empire and the United States).
When Baden Powell re-wrote his manual and published it as Scouting for Boys he fundamentally changed its ethos. He left out many of the military aspects and applied the techniques to other, non-military, heroes of the day like explorers and backwoodsmen. He also added the Scout Method which was an innovative, informal educational system intended to develop good character.
Scouting for Boys was originally published as a six-part series in 1908, and contained activities and programmes intended for use by existing youth organisations. It was an immediate success, but it seems that Baden-Powell had no intention of setting up a separate and distinct movement at that point.
"Scout patrols" which followed the principles set out in Baden-Powell's book were set up across the United Kingdom, and spread rapidly across the British Empire. The first Scout rally was held at Crystal Palace in London the following year. Some 11,000 Scouts attended - including some girls who dressed as Scouts and called themselves "Girl Scouts".
When Baden-Powell left the army in 1910, he founded the Boy Scouts Association and, shortly afterwards, the Girl Guides. In reality though, both organisations already existed in nascent form. People were attracted by the chance to emulate their heroes, and also by the fact that Scouting emphasised more adventurous, outdoor games than were usual in other youth organisations of the time (like the Boy's Brigade, for example). Then, as now, the skills learned by Scouts were seen as fun.
Initially, many groups made dual registrations with the Boy's Brigade and the Boy Scouts Association. This capitalised on the existing infrastructure and fuelled the rapid growth of the Scout movement.
The fact that the Scout movement also catered for girls widened its appeal, since many of the youth movements up to that point had been for boys only. As noted above, the Girl Guides were formed by Baden-Powell and his sister, Agnes, just months after the Boy Scouts Association. (Agnes Baden-Powell would lead the Girl Guides until 1918 when Olave Baden-Powell took over as Chief Guide.)
The programme offered by the Girl Guides was radically different from those being proposed by other organisations for girls at that time. For example, the precursors of the Girls' Brigade had the goal of:
helping girls become followers of the Lord Jesus Christ through self-control, reverence, and a sense of responsibility.
It is not hard to see that many girls, having read Scouting for Boys, would prefer to follow their brothers into scouting, and this is exactly what happened at the first Scout Rally in 1909.
It is, perhaps, sometimes hard to remember just how progressive Baden-Powell was being when he made the decision to include girls in the Scout movement in 1910. For context, it is worth remembering that the girls' equivalent of the Boy's Brigade, the Girls’ Association, wasn't formed until 2008!