The child, who cannot be named for legal reasons, was taken into foster care in Gloucestershire while on a supervised visit with its father.
The parents should have been given 14 days notice, and "serious errors" were made by the local authority, a family court ruled.
Gloucestershire County Council has apologised and said it had now updated its policies.
Judge Stephen Wildblood, in the family court in Gloucester, found the authority's actions were unlawful and had breached the family's human rights.