1620s, "state of being confined; any restraint by force, necessity, or obstacle," from French confinement (16c.; the Old French word was confinacion), from confiner "to border; to shut up, enclose" (see confine).
As "restraint from going abroad by childbirth," perhaps a euphemism for childbed it dates from 1774 (the Middle English expression was Our Lady's bands). To be confined "be unable to leave the house or bed from sickness or childbirth" is attested from 1772.