Can't delete macports directory as root
Although System Integrity Protection will prohibit even the superuser from modifying system files, opt isn't included in that list. The issue is that all applications are fenced off from "important" bits of the filesystem by default and Terminal.app is no exception. In Mojave (OS X 10.14):


System Preferences
Security &amp; Privacy
Privacy tab
Choose "Full Disk Access" from list on left
Click on "padlock" bottom-left and provide superuser password to elevate privileges and allow additions
Click on the "+" sign and navigate in file chooser to Terminal.app


Screenshots are available in http://osxdaily.com/2018/10/09/fix-operation-not-permitted-terminal-error-macos/.

You'll need to restart Terminal for the changes to take effect. The MacPorts uninstall command at https://guide.macports.org/chunked/installing.macports.uninstalling.html - at the time of writing, this:

sudo rm -rf \
        /opt/local \
        /Applications/DarwinPorts \
        /Applications/MacPorts \
        /Library/LaunchDaemons/org.macports.* \
        /Library/Receipts/DarwinPorts*.pkg \
        /Library/Receipts/MacPorts*.pkg \
        /Library/StartupItems/DarwinPortsStartup \
        /Library/Tcl/darwinports1.0 \
        /Library/Tcl/macports1.0 \
        ~/.macports


...should now work.

As a side-note, current versions of iTerm request this permission when first installed and run, so if you have iTerm kicking around and don't want to restart Terminal, add it to the "Full Disk Access" list (if it isn't added already) and run the command there.