Not directly possible in Warcraft III. You will need to trigger the desired mechanics which is not a trivial thing to do.
For a trigger based system you will need a system to represent units carrying resources. This would mean mapping some sort of structure to the unit which contains information such as how much gold they are carrying. To make it look like the worker is carrying gold you will either need to change its animation prefix/suffix to use the gold carrying animations, if that is possible, or use a custom gold sack model which you attach to the unit by triggers and keep track of with the carrying structure. When the worker is ordered to a gold drop off and is near the point you will need to clean the carrying structure from it and give the player the appropriate amount of gold.
Then you need a system to do the actual mining. The simplest would be to pause the unit in place for some amount of time when ordered to the gold ore and near it. During this stage it is made to face the gold ore and loops the mining animation. After the desired amount of time passes then gold is removed from the gold ore unit (if possible) and the worker is given the previously described carry structure to represent that it is now holding gold.
Finally a system is needed to automate this process so the workers go to the gold ore to mine and back to the nearest gold drop off point. This may require keeping track of which workers are automated and to which mines they work.
Now on top of the above full trigger solution there may be a hacky hybrid approach one could try. If one can detect when a unit enters a gold mine then one could make the gold ore a fake gold mine with near instant gold pickup. When a unit picks up gold from the gold ore you then pause them, make them face the gold ore and play their mining animation for some amount of time. After that time expires you unpause them and if necessary order them to return resources. This would allow one to use the standard gold carrying system instead of having to trigger ones own which could reduce the required work considerably, however there may be technical issues with this approach.