The Justice Department is clashing with career site Glassdoor Inc. over the company’s refusal to identify users who posted anonymous employee reviews of a veterans health-care company under federal investigation.

The First Amendment standoff—the existence of which was disclosed in court papers unsealed this week—has opened a new front in the national debate over online anonymity.

The...