It does not seem at all likely ... that it comes from the Scots expression och aye, the Greek ola kala ('it is good'), the Choctaw Indian oke or okeh ('it is so'), the French aux Cayes('from Cayes', a port in Haiti with a reputation for good rum) or au quai ('to the quay', as supposedly used by French-speaking dockers), or the initials of a railway freight agent called Obediah Kelly who is said to have written them on documents he had checked.
A more likely explanation is that the term originated as an abbreviation of orl korrekt , a jokey misspelling of 'all correct' which was current in the US in the 1830s. This ties-in with an unusual political association
The oldest written references result from its use as a slogan by the Democratic party during the American Presidential election of 1840. Their candidate, President Martin Van Buren, was nicknamed 'Old Kinderhook' (after his birthplace in New York State), and his supporters formed the 'OK Club'. This undoubtedly helped to popularize the term (though it did not get President Van Buren re-elected).
English Language 100 FAQ Teaching Pack - only £1.99 using discount code CQDWKF0