Catalyzes the reversible interconversion of the L- and D-stereoisomers of histidine. Functions in the biosynthesis of the metallophore staphylopine, which is involved in the acquisition of nickel, cobalt, zinc, copper, and iron, and thus enables bacterial growth inside the host, where metal access is limited. Therefore, this enzyme probably contributes to staphylococcal virulence. Appears to be specific for histidine, as it cannot use L-alanine and L-methionine as substrate. L-histidine = D-histidine Up-regulated in metal-poor media. Belongs to the histidine racemase family.