How can my iPhone status change to online if it was locked when stolen
The iPhone when locked will join known WiFi hotspots that it's set to join when plugged in to power.
If it's connected to iTunes, it will communicate to the server if someone tries to erase or activate it.
If a working SIM with cellular data is inserted (or you turn data back on) then the lock/tracking can engage


If none of those three items happen, the lock may sit on Apple's servers until cancelled or they shut down / purge old requests. I would turn on your data if you can to get it back or tracking remotely the quickest.

The good news is it's locked to your account, so whoever buys it or tries to sell it won't get any value/satisfaction and your data is as secure as the passcode settings are (4 digits can generally be brute forced, erase after 10 and a longer passphrase/password is generally not crackable). The bad news is without a viable data connection, you can't track it's whereabouts while the battery or device is powered.