Hi there!
I had this same issue and tried many different strategies (factory reset, changing out the SD card, formatting the SD card, etc.), but it kept unmounting itself and/or displaying the notification.
The common thread in these notifications was that they only occurred when booting up the phone or waking it up, which made me think about Android M's new Doze feature and whether it was affecting the System UI, which is the app that produces these SD card notifications (to confirm this, long press the SD card notification and click the settings icon and it will take you to the System UI app information).
As such, I tried the following:
-Go to Settings and select Battery
-Tap More on the top right side and select Optimize Battery Usage
-Change the dropdown menu to All apps
-Scroll down to System UI and deselect it to de-optimize it
-Once you've de-optimized the System UI, take a photo with the phone (that goes onto the SD card) or move an app to the SD card to ensure that it is engaged with the new System UI setting
Since following these steps yesterday, the only time I see the SD card notification is when I restart the phone. I have yet to see it appear at all between restarts.
I hope this works for you!