Ms. Lambrecht is the highest-ranking member of Chancellor Olaf Scholz’s government to resign, and her departure is likely to be seen as a blow to his reputation. The chancellor had repeatedly defended the record of Ms. Lambrecht, a former justice minister and a fellow member of his party, the Social Democrats.