1832 in mathematics and physics, "a quantity which is assumed to be invariable throughout," from constant (adj.), which is attested from 1753 in mathematics. The general sense "that which is not subject to change" (1856) is a figurative extension from this.
Old English neodian "be necessary, be required (for some purpose)," intransitive; also transitive, "require, have need of," from the same root as need (n.). Meaning "to be under obligation (to do something)," especially in negative or interrogative sentences implying obligation or necessity, is from late 14c. Related: Needed; needing. The adjectival phrase need-to-know is attested from 1952. Dismissive phrase who needs it?, popular from c. 1960, is a translated Yiddishism.
Need, especially in negative and interrogative sentences implying obligation or necessity, is often used, in the present, before an infinitive, usually without to, need being then invariable (without the personal terminations of the second and third persons singular): as, he or they need not go; need he do it? [Century Dictionary]
c. 1300, "determined, fixed," from Old French certain "reliable, sure, assured" (12c.), from Vulgar Latin *certanus, extended form of Latin certus "determined, resolved, fixed, settled," of things whose qualities are invariable, "established," also "placed beyond doubt, sure, true, proved; unerring, to be depended upon" (also source of Old French cert, Italian certo, Spanish cierto), originally a variant past participle of cernere "to distinguish, decide," literally "to sift, separate." This Latin verb comes from the PIE root *krei- "to sieve," thus "discriminate, distinguish," which is also the source of Greek krisis "turning point, judgment, result of a trial" (compare crisis).
Transferred sense, in reference to persons, "full of confidence in one's knowledge or judgment, made certain in reference to a matter or thing," from mid-14c. (also a sense in Latin). Meaning "established as true beyond doubt" in English is from c. 1400. Meaning "indefinite, not specifically named, known but not described" is from late 14c.
Different as this seems to be from sense I, it is hardly separable from it in a large number of examples: thus, in [a certain hour], the hour was quite 'certain' or 'fixed', but it is not communicated to the reader; to him it remains, so far as his knowledge is concerned, quite indefinite; it may have been, as far as he knows, at any hour; though, as a fact, it was at a particular hour. [OED]
Lewis & Short write that Latin certus also was sometimes indefinite, "of things, the certainty of whose existence is given, but whose nature is not more definitely designated, or comes not into consideration ...."
Hence the euphemistic use, attested from mid-18c., as in woman of a certain age "an old maid;" woman of a certain description "disreputable woman;" in a certain condition "pregnant;" a certain disease "venereal disease;" of a certain weight "obese." Used with proper names from 1785, "often conveying a slight shade of disdain" [OED]. Certainer, certainest were common to c. 1750, but have fallen from proper use for some reason. Expression for certain "assuredly" is attested by early 14c.