WASHINGTON—The Supreme Court on Tuesday removed a hurdle to the construction of a natural-gas pipeline through Pennsylvania and New Jersey, ruling the pipeline developer could invoke the power of the federal government to take state property needed for the project. The court, in a 5-4 opinion by Chief Justice John Roberts, rejected New Jersey’s challenge to the actions of the PennEast Pipeline Co., a joint venture of several energy companies that aims to build a 116-mile interstate pipeline. Joining the chief justice were two fellow conservatives, Justices Samuel Alito and Brett Kavanaugh, and two liberals, Justices Stephen Breyer and Sonia...