The full form of the word OK is actually "oll korrect."
The phrase is 19th century Boston/New York slang for 'all correct'.
At the time, there was a popular trend in the north eastern United States of abbreviating commonly used phrases, yet this is the only one that survived.
The main reason the phrase remained popular was due to the fact that people genuinely needed a quick way of approving documents, bills and other items... So the word OK gain approval.
In 1919, Woodrow Wilson apparently introduced the misspelling okeh, but the general consensus was that it would be spelled 'okay'.
Interestingly, it's one of the few slang phrases that has acquired its own slang variant - with the 1930s seeing the rise of the term 'okey dokey'.