This is a morbid rule, and it's one that was introduced by the current Monarch, Queen Elizabeth II. When traveling abroad, every member of the Royals must pack a black suit and tie or a black dress, as appropriate. The reasoning behind this is quite simple; in case of a sudden death (and especially a sudden death within the Royal Family), they'll need it for both the funeral, and to be seen in public.
While the chances of this seem low, it actually happened to the current Queen. She was traveling in Kenya with Prince Phillip when her father died, and having been flown back to England, had to wait on the plane until someone brought her a black dress, as she couldn't be seen in public without one due to protocol. It was a frustrating situation to be put into, and so she's looked to ensure it doesn't happen again.