How to keep MacBook Pro from stopping Time Machine when sleeping?
If your MacBook supports Power Nap and is connected to power, go to System Preferences → Energy Saver → Power Adapter → Enable Power Nap while plugged into a power adapter. This will allow Time Machine to wake the computer for a backup.