"all right, correct," 1839, only survivor of a slang fad in Boston and New York c. 1838-9 for abbreviations of common phrases with deliberate, jocular misspellings (such as K.G. for "no go," as if spelled "know go;" N.C. for "'nuff ced;" K.Y. for "know yuse"). In the case of O.K., the abbreviation is of "oll korrect."
Probably further popularized by use as an election slogan by the O.K. Club, New York boosters of Democratic president Martin Van Buren's 1840 re-election bid, in allusion to his nickname Old Kinderhook, from his birth in the N.Y. village of Kinderhook. Van Buren lost, the word stuck, in part because it filled a need for a quick way to write an approval on a document, bill, etc.
Spelled out as okeh, 1919, by Woodrow Wilson, on assumption that it represented Choctaw okeh "it is so" (a theory which lacks historical documentation); this spelling was ousted quickly by okay after the appearance of that form in 1929. Greek immigrants to America who returned home early 20c. having picked up U.S. speech mannerisms were known in Greece as okay-boys, among other things.
The noun is first attested 1841, "endorsement, approval, authorization" (especially as indicated by the letters O.K.); the verb, "to approve, agree to, sanction," is by 1888. Okey-doke is student slang first attested 1932.
translating Old Norse Groenland, so named by its discoverer (986 C.E.) because "it would induce settlers to go there, if the land had a good name":
Hann gaf nafn landinu ok kallaði Groenland, ok kvað menn þat myndu fysa þangat farar, at landit ætti nafn gott. [Islendingabok, 1122-1133]
"also" (obsolete), from Old English eac, from Proto-Germanic *auke (source also of Old Saxon, Old Dutch ok, Old Norse and Gothic auk, Old Frisian ak, Old High German ouh, German auch "also"); probably related to eke (v.).