KARACHI, Pakistan—Authorities in Pakistan approved sweeping new regulations restricting social media, rules that would dramatically change the way companies such as Facebook and Twitter operate in the country and critics say would threaten freedom of expression.

Under the new regulations, passed by Pakistan’s government Wednesday, media companies must remove content Pakistani authorities deem objectionable, set up offices and data centers in the country, and remove the encryption on content if requested by authorities. They...