According to the Oxford English Dictionary, it's quite an ancient phrase that emerged from an archaic form of the subjunctive mood:
a. Introducing a supposition, expressed by the subjunctive mood: As if, as though. arch.
1135 Anglo-Saxon Chron., Uuard þe sunne suilc als it uuare thre niht ald mone.
As the definition above suggests, a rough modern English equivalent to this original use might be 'as if,' as in 'he reeled as if hit by a sledgehammer.'
The OED dates its current sense to c1400:
c1400 (1387) Langland Piers Plowman (Huntington HM 137) C. ix. l. 22 Ich wolde a-saye som tyme for solas, as hit were.
c1405 (1390) Chaucer Nun's Priest's Tale (Hengwrt) (2003) l. 26 She was as it were a maner deye.
1531 T. Elyot Bk. named Gouernour iii. xi. sig. ci, It draweth a man as it were by violence.
These uses are clearly different from the original, and closer to the modern use, but it's not hard to imagine a plausible narrative to explain how they might have arisen from the original.