You just ran the pump dry. If a JK is anything like a TJ then it has an intank pump (not really all that important, because any vehicle will function effectively the same way with an intank pump, inline pump, or mechanical fuel pump).
When you turn the key to the on position this kicks on the relay to the fuel pump and it 'primes', pumping for about 3-4 seconds, and then shuts off. This ensures that there is sufficient fuel pressure in the fuel rails, because of bleed down, when you go to turn the key. So what you were doing by cranking it with a dry pump was that your pump was, for a few seconds at least, priming the fuel rail with air and then trying to inject it into the cylinders and fire. Not very effective. So after you continued cranking and it eventually picked up the fuel at the pump, primed the lines and the rails and then the fuel injectors fired at a sufficient pressure for ignition.
It is not wrong, just puts more strain on your starter, and didn't do any damage to the engine.
In the future, just cycle the key from the off position to the on position about 10-12 times, this will have your fuel pump prime the lines every time you cycle the key before you go to fire it up. I guarantee it will fire like normal if you try this procedure in the case of running out of gas again.