I believe it started in WWII. If a person was killed a Gold Star was hung in the window of the parents.
Blue star for each son in the service, gold star for any that died in service.