Zakat is obligated on ore excavated from gold or silver mines as soon as one puts his hand on it if it is greater than the nisab.
However, paying zakat should be carried out after cleaning and refining.
This is true as long as the excavator is one who is liable to pay zakat, i. e. a Muslim.
As for non-Muslims, zakat should not be taken from them.
In fact, the (Muslim) ruler should prevent them from excavating metals and taking them out of the lands of Muslims.
The amount of zakat on (precious) metals is also a quarter of one tenth for any amount greater than twenty mithqals of gold, or two hundred dirhams of silver or more.
The passage of a term is not a condition of such zakat, rather it is obligated as soon as the (precious) metal is obtained, as mentioned previously.