In an abrupt reversal, the federal government said Monday that it would allow emergency contraceptive Plan B to be sold in drugstores without restrictions and would end an appeal in a long-running court case.

In a court filing Monday, the Justice Department said the Food and Drug Administration would make the Plan B pill available without age or point-of-sale restrictions, such as having to show identification to buy it.

The...