During months of negotiations, Republicans and Democrats on the Senate and House Armed Services committees agreed to eliminate a “religious freedom” provision Democrats said would have let federal contractors discriminate against workers on the basis of gender or sexual orientation.