The reasons behind the Could't modify partition map error could be corrupted, unknown, or missing partition map of the disk, write protection on the SD card, corrupted files or disk errors on the drive, etc. Possible solutions include unlocking the SD card, repairing the disk, and erasing the SD card again.
Even if the card's lock switch is not engaged as you said, the SD card could be also write-protected, you can remove write protection from the SD card by cleaning the SD card's metal connectors, clearing read-only attributes on the SD card, and editing Windows Registry.
Besides, the couldn't modify partition map error may also relate to SD card corruption, therefore you can't format the SD card and see the error message. You should repair the SD card with Disk Utility and then try to reformat it again.
- Open Disk Utility from Finder > Applications > Utilities.
- Connect the SD card to your Mac.
- Click View > Show All Devices in Disk Utility.
- Select the SD card from the left device list and click First Aid.
- Choose Run to start checking and repairing the SD card.
- When the process completes, click Format again.
If you fail to format the SD card in Disk Utility again, try formatting it with Terminal using the command diskutil eraseDisk File_System Disk_Name /dev/diskN.