It stands for Oklahoma or
In the late 1830's it was a misspelling of all correct - originally "orl korrect".
It was part of the abbreviation fad that started in 1838 in Boston when the newspaper began to use satire when referring to our first men (OFM). They also used NG, "no go," GT, "gone to Texas," and SP, "small potatoes."
Many of the abbreviated expressions were exaggerated misspellings like OW, "oll wright," and there was also KY, "know yuse," KG, "know go," and NS, "nuff said." OK was "orl Korrect" and was one of the few that actually withstood the test of time... It is kinda of like text messaging today...with the LOL, LMFAO, BRB, and L8trz... :)