What causes a Mac to lose its serial number?
A lack of a visible serial number should not affect your Mac.

Apple does not guarantee a serial number will be set. Technical Note 1103 warns developers not to rely on a serial number being available to uniquely identify a Mac.

The technical note suggests the serial number can vanish if hardware components are changed. Other reasons appear to be possible but Apple does not enumerate every cause:


  Caveats for using the serial number
  
  It is possible for a system to lose its serial number so that it will no longer appear either in System Profiler or the I/O Registry. Repairing a system by swapping hardware components is one reason this can happen. Apple does not document the specific details of how a machine can lose its serial number. Once the serial number has been lost there is no means to restore it to the machine.
  
  Apple does not guarantee that all future systems will have a software-readable serial number.
  
  Both of these cases illustrate why asset tracking software should always provide a way for a serial number to be entered manually.


I am not aware of any further documentation about restoring the serial number. If it is possible, this capability is likely to only be available to Apple engineers or support staff.