I think it's clear he hit Locke to reveal the OT to him. My question is, how did he know that scenario he put him in would be similar to an event that has occured in his "other life"? As viewers it seemed obvious the writers wanted us to remember Locke's fall from the window (they even made the blood on his face look the same). But not only does Desmond not know about this moment in John's life, but it never even happened in the ALT. I guess it just boils down to Desmond trying to provide a near-death experience of any sort for John's mind to bleed over into the OT. It seemed like maybe Locke was about to experience something at the end. So it probably worked. But my other (rhetorical) question is what if Locke died from that? Maybe Desmond needs to actually kill him because he is dead in the OT. There are a few theories that work right now.