Serena Williams consulted the Duke and Duchess of Sussex before she decided to retire from tennis this year.