Three judges in London declared today that the regulations under which most of the schemes were created are unlawful and quashed them.
The Government expressed "disappointment and surprise" at the decision and said it now intends to introduce new regulations to ensure future schemes are lawfully based.
Moves to appeal to the Supreme Court against the ruling are also under consideration.
Miss Reilly, 24, from Birmingham, and 40-year-old unemployed HGV driver Jamieson Wilson, from Nottingham, both succeeded in their claims that the unpaid schemes they were required to participate in were legally flawed.
Their solicitors said later the ruling means "all those people who have been sanctioned by having their jobseeker's allowance withdrawn for non-compliance with the back-to-work schemes affected will be entitled to reclaim their benefits".
Public Interest Lawyers said: "The result is that over the past two years the Government has unlawfully required tens of thousands of unemployed people to work without pay and unlawfully stripped thousands more of their subsistence benefits."
Employment minister Mark Hoban said he was disappointed and surprised at the court's decision on the regulations.
But he said the judges' ruling had upheld the Government's right to run back-to-work schemes.
Mr Hoban said: "The court has backed our right to require people to take part in programmes which will help get them into work.
"It's ridiculous to say this is forced labour. This ruling ensures we can continue with these important schemes.
"There needed to be flexibility so we could give people the right support to meet their needs and get them into a job.
"We do not agree with the court's judgment and are seeking permission to appeal, but new regulations will be tabled to avoid any uncertainty.
"Ultimately the judgment confirms that it is right that we expect people to take getting into work seriously if they want to claim benefits."
Today's ruling was made unanimously by Lord Justice Pill, Lady Justice Black and Sir Stanley Burnton.
In November 2011, Miss Reilly had to leave her voluntary work at a local museum and work unpaid at the Poundland store in Kings Heath, Birmingham, under a scheme known as the "sector-based work academy".
She was told that if she did not carry out the work placement she would lose her jobseeker's allowance.
For two weeks she stacked shelves and cleaned floors.
Mr Wilson, a qualified mechanic, was told that he had to work unpaid, cleaning furniture for 30 hours a week for six months, under a scheme known as the Community Action Programme.
He objected to doing unpaid work that was unrelated to his qualifications and would not help him re-enter the jobs market.
He refused to participate and as a result was stripped of his jobseeker's allowance for six months.
In his ruling, Lord Justice Pill said the case raised a question of "statutory construction".
He said the challenge was to the lawfulness of the 2011 Government regulations made by Ian Duncan Smith, Secretary of State for Work and Pensions, under sections of the Jobseekers Act 1995.
The judge said he was "unable to conclude that the statutory requirement for the regulations to make provision" for back-to-work schemes "of a prescribed description" had been met.
He ruled: "The statutory requirement is that the prescribed description is in the regulation."
Declaring the regulations unlawful, the judge said they must be quashed since their central purpose was to impose "requirements" on jobseeker allowance claimants and sanctions for failing to comply.
Agreeing with Lord Justice Pill, Sir Stanley Burnton said: "I emphasise that this case is not about the social, economic, political or other merits of the Employment Skills and Enterprise Scheme.
"Parliament is entitled to authorise the creation and administration of schemes that ... are designed to assist the unemployed to obtain employment, and provided that the schemes are appropriate for that purpose, it is not easy to say what objection there could be to them.
"Parliament is equally entitled to encourage participation in such schemes by imposing sanctions, in terms of loss of jobseeker's allowance, on those who, without good cause refuse to participate in a suitable scheme.
"This appeal is solely about the lawfulness of the regulations made by the Secretary of State in purported pursuance of the powers granted by the 1995 Act as amended.
"Furthermore, like Lord Justice Pill, I recognise that there are considerable advantages in there being a large measure of flexibility in designing and administering a statutory scheme.
"However any scheme must be such as has been authorised by Parliament."
Ms Reilly was later hailed as "a hero" for bringing her challenge, which she lost in the High Court but won on appeal.
She said: "I am delighted with today's judgment.
"I brought this case because I knew it was wrong when I was prevented from doing my voluntary work in a museum and forced to work in Poundland for free for two weeks as part of a scheme known as the sector based work academy.
"Those two weeks were a complete waste of my time as the experience did not help me get a job.
"I wasn't given any training and I was left with no time to do my voluntary work or search for other jobs.
"The only beneficiary was Poundland, a multimillion-pound company. Later I found out that I should never have been told the placement was compulsory.
"I don't think I am above working in shops like Poundland. I now work part-time in a supermarket. It is just that I expect to get paid for working.
"I hope the Government will now take this opportunity to rethink its strategy and do something which actually builds on young unemployed people's skills and tackles the causes of long-term unemployment.
"I agree we need to get people back to work but the best way of doing that is by helping them, not punishing them.
"The Government ought to understand that if they created schemes which actually helped people get back into work then they wouldn't need to force people to attend."
PIL solicitor Tessa Gregory said: "The case has revealed that the Department for Work and Pensions was going behind Parliament's back and failing to obtain Parliamentary approval for the various mandatory work schemes that it was introducing.
"It also reveals a lack of transparency and fairness in the implementation of these schemes.
"The claimants had no information about what could be required of them under the back-to-work schemes.
"Today's judgment sends Iain Duncan Smith back to the drawing board to make fresh regulations which are fair and comply with the court's ruling.
"Until that time nobody can be lawfully forced to participate in schemes affected such as the Work Programme and the Community Action Programme.
"All of those who have been stripped of their benefits have a right to claim the money back that has been unlawfully taken away from them."
Len McCluskey, general secretary of Unite, Britain and Ireland's largest trade union, described Ms Reilly as a "hero for challenging this flawed scheme".
Other union leaders and campaigners joined in the call for the Government to ditch schemes requiring people to work for no pay or lose benefits.
A DWP spokesman said: "We have no intention of giving back money to anyone who has had their benefits removed because they refused to take getting into work seriously.
"We are currently considering a range of options to ensure this does not happen."
But Mr McCluskey called on the Government to "ditch this forced labour scheme for big business" and "focus on creating real jobs to help give one million young unemployed people a real future".
Mark Serwotka, general secretary of the Public and Commercial Services union, said: "The Government cannot continue to help private companies and charities to exploit people who are out of work, and these schemes must surely now be scrapped and the work brought back in-house."
Karen Jennings, assistant general secretary of the public service union Unison, said: "It is time for the Government to ditch these unlawful policies which force people to work without pay or lose their benefits.
"Multimillion-pound companies receiving free labour are the only winners of the Tory back-to-work programmes."
Matthew Sinclair, chief executive of the TaxPayers' Alliance, said welfare "can't be an alternative to work", and added: "The Government needs to stand by the simple principle that benefits are there to provide a safety net that will catch people when they fall, not a comfy hammock they can rest in indefinitely at the expense of struggling taxpayers."
Claire Laker-Mansfield, spokeswoman for Youth Fight for Jobs, said: "The Government must now respond to this ruling by immediately shutting down all unpaid workfare schemes.
"These schemes have in fact amounted to a massive subsidy to big business."
She said it was "high time" the Government started investing in creating secure, socially useful jobs "not punitive, ineffective slave labour schemes".
Joanna Long, a member of Boycott Workfare, a UK-wide campaign network to end forced unpaid work for people who receive welfare, said the group was confident the ruling "spells the end for workfare in the UK".
She said Boycott Workfare's week of action on March 18-24 "will go ahead with the aim of bringing Mandatory Work Activity to an end" and the "campaign will do all it can to ensure those sanctioned are repaid in the coming weeks".
Mr Hoban said the Government would be pushing through emergency regulations to enable the scheme to continue.
"What the judge said is that there should be more detail in the regulations. What we are doing today is introducing emergency regulations to provide that detail," he told BBC Radio 4's The World At One.
"So it's business as usual for people who want support to look for a job. At the same time we are going to appeal this judgment."
For Labour, shadow work and pensions secretary Liam Byrne said: "It beggars belief that David Cameron's Government is now so incompetent it can't even organise work experience.
"Work experience is crucial in helping many young people get ready for work. Two years in, David Cameron and Iain Duncan Smith's so-called welfare revolution is in a state of advanced chaos."
Matthew Oakley, head of economics and social policy at Policy Exchange, said: "Let's be clear. This is not a ruling against back-to-work schemes and should not be seen as some sort of body blow to the Government's welfare plans.
"The main problem in this particular instance was miscommunication of the requirements and penalties for not complying, rather than the policy itself.
"Ultimately, the Government's approach is the right one. Giving young people the experience they need to enter the world of work is exactly the right thing to do and we should not allow people with no previous experience and who are claiming benefits the opportunity to pick and choose the sorts of jobs they go for.
"It is also right that more support is given to people who have spent extremely long periods - in some cases over three years - unemployed.
"With such long periods out of work it is essential they are helped to find placements where they can get the experience they need to re-enter work.
"The vocal lobbying against these programmes is damaging the chances of these groups finding employment."