Spyware can still work if a phone is turned off. This is because some spyware can be installed remotely, and doesn't require the phone to be turned on in order to function.