Too long for a comment, so let it be an answer.
@Joe mentioned light radiation coming from the forge.
Well, historical timespan usually wouldn't be long enough for evolutionary changes to kick in, especially in a society. Something that kills majority of specimen without desired trait / does not allow them to reproduce would be needed.
In medieval times, childbirth was really dangerous procedure and giving birth in sterile-ish environment would be a good thing to do. I mean, they would quickly notice that it simply works, no matter how they explain that to themselves.
For example, take a look at black banya. Birch wood contains tar and so does birch smoke, so insides of black banya were covered with soot and tar. It was pretty germ-less space so people would give birth there and it worked (also access to hot water).
What if some group of dwarves for whatever reason tried giving birth near the forge? If they have some cult of those then forge would be cleanest place around and UV radiation and high temperature would wipe out all germs on a regular basis. Giving birth there would give a higher survival rates than, say, in bedroom. Also, having clan of proud "forgeborn" dwarves is pure awesome!
Minor problem though: subjecting newborns to intense UV may not be a great idea because cancer. If dwarves also have higher regeneration rates than humans, cancer would be even more of a problem. And it won't kick in immediately so they'll notice how their custom is actually killing them.
Maybe simply make them sterile, that would work too. You only need to sterilise one gender. Immune system actually finds and kills majority of cancerous cells, and kids' immune systems are really powerful. If some cells crucial to reproduction are the most suspectible to cancer and are close to skin then irrepairable damage would be done, but specimen may survive and not even notice that something is wrong. Of course, you will need higher levels of UV than dwarves were naturally accustomised to.
Only dwarves that woudld pass on their genes would be really thick-skinned ones - against UV, too. Having high melanin in your skin would be an obvious way to go - and very likely, too (since that's the thing that evolution "cares" about). A ten generations or so of purge like this and there would be very, very little traces of non-black dwarven blood among this group.
Since digging a tunnel to a neighbouring mountain is way slower and harder than going by surface, dwarves would travel less than surface-dwellers. Thus, their rates of cultural exchange would be even slower. Some clans can practice forgebirth and other clans - some alternatives, like the thing with banyas.
You will have both black and white dwarves that way, perfectly genetiaclly compatible.