With firmware 1.18 and earlier, if the Duet can't see the old network then it will switch back into access point mode, so you just repeat the initial install procedure. If the old WiFi network is still visible, temporarily turn off WiFi on the old access point to do this.
Firmware 1.19beta maintains a list of known access points, and you can add and delete entries using the M587 and M588 commands. See https://duet3d.com/wiki/DuetWiFiFirmware_1.19beta if you want to try this version.