The forge is a large metalworking furnace object. It is used for smelting various metal ores gathered from mining. You do not interact with the forge, you just have to be in the vicinity of the forge to smelt.
They can be found around most Dwarven towns and other races' encampments too, but occasionally at mob encampments also. Forges are often found paired with an anvil (which has similar use characteristics).
See a list of Forges, Anvils, and Mailboxes locations.
In real life, a forge is an open furnace used to heat refined metal for working; it is not generally the furnace used for refining. One of the requirements of the refining process is excluding contact with oxygen. Actual metalworking would require a forge and an anvil for metalworking, and a separate closed furnace or a crucible for refining. (A closed crucible could be heated on a forge, and this would have been a common technique in days gone by.) The graphics used in the game represent forges, not refining furnaces.
This is reflected in the game in that refining is part of the mining trade, not a part of the metalworking trades.