Possibly you’re thinking of the Bethlem Hospital, founded in the twelfth century and refounded in the seventeenth century, now a psychiatric hospital but once a house of correction, though not necessarily for unmarried mothers.
History of Bethlem before it was used for lunatics:
The priory of St Mary of Bethlem was founded in 1247 as a priory in Bishopsgate Street, for the order of St. Mary of Bethlehem, by Simon Fitz Mary, an Alderman and Sheriff of London. The Catholic Encyclopedia says it was a hospital (place of refuge) from the begining ‘originally intended for the poor suffering from any ailment and for such as might have no other lodging, hence its name, Bethlehem, in Hebrew, the “house of bread."’
I can’t for some reason provide the link, but if you do a search on “(Bethlem Hospital) was first employed to the use of distracted” you should get a very full (300+ pages, if you’re interested) account of UK state medicine.