1590s, "liveliness, wit, vivacity," from Middle French esprit "spirit, mind," from Old French espirit "spirit, soul" (12c.), from Latin spiritus "spirit" (see spirit (n.)). For initial e-, see e-.
Esprit de corps, recorded from 1780 in English, preserves the usual French sense. French also has the excellent phrase esprit de l'escalier, literally "spirit of the staircase," defined in OED as, "a retort or remark that occurs to a person after the opportunity to make it has passed." It also has espirit fort, a "strong-minded" person, one independent of current prejudices, especially a freethinker in religion.