Ima is an informal contraction of I'm going to when it's used in going-to future construction - not in sentences like I'm going to London etc. It's also written i'ma or imma in informal conversations.
How did I'm going to come to be pronounced/spelt that way?
In casual speech, we tend to drop consonants that require more effort to articulate, assimilate nearby consonants, drop weak vowels etc., for the ease of articulation. Grammatical words that don't have any meaning on their own (function words?) like have to, going to (not present continuous), has, is, was, will etc., are highly susceptible to these sound changes. For instance, have to is often pronounced hafta, trying to is pronounced tryna, want to is wanna etc etc. The same thing happened to the phrase I'm going to.
There are a few processes involved in the reduction of I'm going to to ima.
I'm going to → I'm gonna: the consonant t is often dropped in many other clusters and grammatical constructions as well (as in tryna, wanna etc). Here it's dropped and the vowel of to—which is usually a schwa [ə]—is linked with the preceding word; going to → gonna: [ˈɡəʊɪ̃ŋtə] → [ˈgə̃nə]
Deletion of the /g/: plosives (/g t d k/ etc) require great effort to articulate (the air is completely blocked and then released), so people dropped the plosive /g/ to make its articulation easier: [aɪ̃m gə̃nə] → [aɪ̃m ə̃nə] (i'm ana)
linking I'm and gonna: In causal and connected speech, consonants and vowels are often linked by a process called liaison, so both I'm and gonna join together and become [aɪ̃mə̃nə] (i'mana).
Syncope of the vowel in the second syllable: Unstressed schwas are often lost through syncope (for example, 'chocolate' is choc.late for most speakers). If we removed the schwa from the second syllable, we'd get [aɪmnə] (i'mna).
Deletion of /n/: It's simple cluster reduction. In English, two nasals that are next to each other are often reduced to a single nasal (as in damn), so the /n/ is deleted, yielding in this case [aɪ̃mə] (i'ma). Or people dropped the /n/ for the sake of ease.
Some people further reduce the diphthong [aɪ] it to something like [a], which results in [ãmə] (ama)
That's why people spell it that way. It's highly informal and as TypeIA pointed out in a comment, it's mostly a verbal thing and is not usually found in written form. It's commonly found in chatspeak or lolspeak. You shouldn't write it in any kind of writing...