Unless you're providing volume control for an analog audio amplifier, a digital pot is usually not the answer.
You use a DAC to generate a voltage to send in place of the potentiometer wiper. Many motor controllers
detect faults on the potentiometer for safety reasons, so you may need to replace the pot with a fixed
value resistor (of the same value, usually 5k or 10k).
Using a digitpot would mean ensuring the controller and arduino are always powered up together to
avoid phantom powering of the digipot chip (which might fry it). A DAC output (via a 10k resistor for current
limiting) is simpler and more robust.
You could also low-pass filter a PWM output and use analogWrite() directly. A 10k, 10uF RC filter would be
reasonable.
However the first thing to do is check the voltages used on the existing pot - probably 0 to 5V, but if not a
rethink is needed.