Melanie Woolcock was sentenced to 81 days in prison by Bridgend magistrates in July 2016 for failing to pay £10 a week towards her debt.
She spent 40 days behind bars before being released on bail.
In a decision on Wednesday, Mr Justice Lewis ruled she should never have been imprisoned.
London's High Court heard that Miss Woolcock owed more than £4,700 in council tax.
She had been ordered to pay off the debt at a rate of £10 a week but she said she was too sick to work and struggled to pay rent and feed herself and her teenage son.
After she failed to keep up instalments, Bridgend magistrates ordered her imprisonment on 18 July.
'No culpable neglect'
Bailiffs arrived on her doorstep on 8 August and although by then she had paid £100 towards the debt, she was told it was "too late".
She was arrested by two police officers and had to phone her mother to ask her to look after her son.
Miss Woolcock was then driven to Bridgend police station, and from there to a prison in Gloucestershire, where she spent 40 days.
She was released on bail on 16 September after lawyers launched emergency proceedings.
Ruling her committal to prison unlawful, Mr Justice Lewis said: "There was no evidential basis on which the magistrates' court could conclude that there had been culpable neglect in non payment."
A Porthcawl woman was unlawfully jailed for not paying council tax, a High Court judge has ruled.