I had an SD card as internal storage in my Android, reset my phone to factory. SD card would no work in that device. I am no longer able to use that device because the screen is smashed anyhow. How can I recover the data from the SD card? I tried to reformat on my laptop but the disk is write protected.
This is very device dependent.
The first option you should try when recovering your data from the external SD Card is to REMOVE the card, Place it into an adapter & put it into a computer.
Try to access the data that way,
From my personal experience a research on Android, I can not find any reference to the SD Card being encrypted as the comments suggest in your question.
Samsung device's do have SD Card encryption by default, However this is not say an " Android " thing to be expected, usually you need to manually encrypt your SD Card.
The SD Card is however Formatted in Fat32 or just Fat, and it usually has a Linux partition for speeding up transfers.
You need to place the card into a computer and use a data recovery software... Because I'm on Windows 10, I suggest Recuva by Piriform because it has a decent home version.
Another option to try if you do have encrypted data is to do a recovery anyway.. Often not all data is encrypted, only necessary data to read the drive is encrypted.