Middle English kēpen, from late Old English cepan (past tense cepte) "to seize, hold; seek after, desire," also "to observe or carry out in practice; look out for, regard, pay attention to," from Proto-Germanic *kopjan, which is of uncertain origin. Old English cepan was used c. 1000 to render Latin observare, so perhaps it is related to Old English capian "to look" (from Proto-Germanic *kap-), which would make the basic sense "to keep an eye on, see to it."
The word prob. belonged primarily to the vulgar and non-literary stratum of the language; but it comes up suddenly into literary use c. 1000, and that in many senses, indicating considerable previous development. [OED]
The senses exploded in Middle English: "to guard, defend" (12c.); "restrain (someone) from doing something" (early 13c.); "take care of, look after; protect or preserve (someone or something) from harm, damage, etc." (mid-13c.); "preserve, maintain, carry on" a shop, store, etc. (mid-14c.); "prevent from entering or leaving, force to remain or stay" (late 14c.); "preserve (something) without loss or change," also "not divulge" a secret, private information, etc., also "to last without spoiling" (late 14c.); "continue on" (a course, road, etc.), "adhere to" a course of action (late 14c.); "stay or remain" (early 15c.); "to continue" (doing something) (mid-15c.). It is used to translate both Latin conservare "preserve, keep safe" and tenere "to keep, retain."
From 1540s as "maintain for ready use;" 1706 as "have habitually in stock for sale." Meaning "financially support and privately control" (usually in reference to mistresses) is from 1540s; meaning "maintain in proper order" (of books, accounts) is from 1550s.
To keep at "work persistently" is from 1825; to keep on "continue, persist" is from 1580s. To keep up is from 1630s as "continue alongside, proceed in pace with," 1660s as "maintain in good order or condition, retain, preserve," 1680s as "support, hold in an existing state." To keep it up "continue (something) vigorously" is from 1752. To keep to "restrict (oneself) to" is from 1711. To keep off (trans.) "hinder from approach or attack" is from 1540s; to keep out (trans.) "prevent from entering" is from early 15c.