If you mean USB, then read this post
http://www.tomshardware.com/forum/272402-32-flash-drive
(scroll down to "My USB Flash device is write protected")
If you have an SD card, most of the steps still apply, but you can also use the SD Card formatter
https://www.sdcard.org/downloads/formatter_3/
If none of these steps work, it might be that the drive/card wore out/died...