In the event of a serious incident whereby the emergency services attend, to account for all souls on board, they need to know the TOB (Total on Board). By informing all the passengers, more people will know that figure and therefore 'Someone' will be able to cascade that info to the services/rescuers.
Rational behind it is that, if it's a serious incident, there may not be many survivors and there may not be any Pilots/Cabin Crew to relay that vital piece of info
all the best
CB