Whenever I write ok the spell checkers underline it with a red line and suggest that I should OK. Not even Ok works. Why is that?
OK is Ok, and Ok is OK.
Oh, also Oklahoma is OK. That's its USA postal code, so it's possible that your spell-checker is agnostic on the subject, and just thinks you are trying to use the state of Oklahoma in an address.
I upvoted @camelbrush's answer because it provides a good explanation of the logic behind why some folks prefer to capitalize both letters. However, nobody is really sure where this word came from. Wikipedia has a table of around 30 of the more popular theories (from 13 different languages).
Realistically one just has to accept that both are in common use, and neither is provably "wrong". If the uncertainty really bugs you, just use the word "Okay" instead.
OK is an abbreviation. This is what Oxford online dict says about its origin:
mid 19th century (originally US): probably an abbreviation of orl korrect, humorous form of all correct, popularized as a slogan during President Van Buren's re-election campaign of 1840 in the US; his nickname Old Kinderhook (derived from his birthplace) provided the initials
Now, let us look at this style guide about capitalization (Guardian Style Guide):
Use all capitals if an abbreviation is pronounced as the individual letters: BBC, VAT, etc; if it is an acronym (pronounced as a word) spell out with initial capital, eg Nasa, Nato, unless it can be considered to have entered the language as an everyday word, such as awol, laser and, more recently, asbo, pin number and sim card. Note that pdf and plc are lowercase.
Here is another style guide that suggests:
Abbreviations that can be pronounced are usually acronyms, ie, words formed from or based on the initial letters or syllables of other words, such as radar, NATO, UNESCO. These are not normally preceded by the definite article.
But then, different office suites (MS Office, Libre Office, Lotus, etc) imply these rules differently. MS Office accepts both Ok and OK.