OK comes from the work ‘oll korrect or orl korrect‘ a deliberately misspelled writing of ‘all correct’. In 1930s in Boston, there was a time when abbreviation of every words was a fashion and to make abbreviation sound perfect to ear misspellings were done intentionally and so came the work OK! Just like Ok there were some more abbreviation like OW for ‘oll wright’, KY for ‘Know Yuse’ but with time a lot fade away but OK is still widely used.
There is another possibility of the work OK i.e. coming from a Greek word ‘ola kala’ meaning ola as all/everything and kala as good. Reading in detail will give a lot of history behind the word OK but the above two sounds purely logical to accept!