This from the OED
O.K. (______), a., n., and v. colloq. (orig. U.S.). Also OK, o.k., ok.
[App. f. the initial letters of oll (or orl) korrect, jocular alteration or colloq. pronunc. of _all correct': see A. W. Read in Amer. Speech XXXVIII (1963), XXXIX (1964), etc.
From the detailed evidence provided by A. W. Read it seems clear that O.K. first appeared as a jocular alteration of the initial letters of all correct (i.e. orl korrect) in 1839, and that in 1840 it was used as an election slogan for _Old Kinderhook' (see sense A b). Thence by stages it made its way into general use. Other suggestions, e.g. that O.K. represents the Choctaw oke _it is', or French au quai, or that it derives from a word in the West African language Wolof via slaves in the southern States of America, all lack any form of acceptable documentation.]