A U.S. judge ordered Facebook Inc to give shareholders emails and other records concerning how the social media company handles data privacy, after data for 87 million users was accessed by the British political consulting firm Cambridge Analytica.