How do I turn on GOD mode in the first Commander Keen?
Press G+O+D, all at the same time. I believe you can do this at any point in the game. There should be a notification that pops up when you've done this successfully.
You can also press C+T+space, all at the same time, to get the pogo stick, full ammo, and all key cards. You will still be vulnerable to enemies in this mode.