"notch, groove, slit," mid-15c., nik, nyke, a word of unknown origin, possibly from a variant of Old French niche (see niche). Nick of time is first attested 1640s (nick of opportunity is 1610s), possibly from an old custom of recording time as it passed by making notches on a tally stick, though nick in the general sense of "critical moment" is older (1570s, Hanmer, who adds "as commonly we say") than the phrase. Nick (n.) specifically as "notch of a tally" is attested from late 15c.
1520s, "to make a notch or notches in," from nick (n.). Sense of "to steal" is from 1869, probably from earlier slang sense of "to catch, take unawares, arrest" (1620s). The precise sense connection is unclear. Related: Nicked; nicking.