Today another example for the sound change ki->i. 垣 is the character for the word kaki, ie a fence. 間, ma, refers to an interval in space or time, and by extension, a gap. And finally, miru is to see.
Thus the original expression kakima miru quite literally says watch/observe/look through the gaps of a fence and was later simplified to kaimamiru. Curiously, this time kanji were helpful in our endevour.
On a side note, the first part, kaima is often also written in kana alone.