@y2kn from what/where/how are you trying to format the card? In my experience, by using a micro-sd/full-size-sd-cartridge-adapter (or however those may be called) there are times/ports/windows-systems which are recognizing such a micro-sd-in-full-size-sd-cartidge either via external usb-cardreader or via build-in-front-panel-cardreaders as locked, even if the adapter-cartridge is set to writable... sometimes (for external card-readers) depluging,repluging helped, sometimes it worked on a different usb-port... On certain machines/ports it seem to be a gamble for micro-sd in full-size-cartride, on other machines I never experienced it (even with the same external card-readers). Still, those observations are the minority of all cases [accessing a micro-sd card by card-readers] observed - and if the problem persists on a particular card, most propably @Folly explanation may nail it.
Btw. have you tried booting raspberry os (or another desktop os) from usb, then inserting the sd-card and checked what gparted (maybe needed to be installed via apt(manager of choice)) is reporting and maybe, instead of just formating, it would be possible to (re)write (the/)a new partition table and a fresh partition to it.
P.S.: You really haven't tried to format the card from a OS running/booted via that card, or?