As per the documentation
Google enqueues and stores the message in case the device is offline.
When the device is online, Google sends the message to the device.
Detailed Explanation
If the device is not connected to GCM, the message will be stored until a connection is established.
how long can the message persist on the GCM server when the device is offline
If the device never gets connected again the message will eventually time out and be discarded from GCM storage. The default timeout is 4 weeks, unless the time_to_live flag is set.