From at least 1770. Possibly from crabapple and the use of lantern-like slits for ventilation.
crab lantern (plural crab lanterns)