For whomever this may help - and it's true, MANY people end up putting the SD card into the CD/DVD slot of an iMac, as it's just so simple and normal to do, sitting in front of the screen and looking for the side slot by feel. Worse, the SD slot is less than an inch from the much larger Superdrive slot and for anyone who has often used the DVD slot it's like automatic to assume the slot you're looking for is right there, and the SD card easily fits, and when you notice a second later that it went all-in rather than stopping... whoops!
This happened to me about 3 months ago, and I researched "here" and general Google search, and saw several YouTube videos, some helpful, some not so much. But the gist is, get a 6-8 inch or so cardboard or similar stiffness cutout of a stem and a little inch-or-so "hook" at the end, and go fishing.
I failed on first try, and second. I'm not about to take the glass off myself. Yes, it's true that it's tough to see anything, given the felt dust protectors obscuring any view inside. I don't want to lug this huge thing to an Apple store unless necessary. So I tried again, failed, and tried a third time, powered off and placed on its side so maybe gravity would help. It didn't. I fished and occasionally hit the release mechanism, but nothing came out. I gave up and - as I rarely use DVD/CD now - I resigned to using my (USB) SuperDrive or other computers when I need to burn or load a disk. So I dug in, and thought someday, maybe... although I'd really like to see what's on that SD card too, as that was the original idea when putting it in the slot.
Upshot: I got the urge to try again after seeing a few more vids with the same solution, and having pretty much written off the drive, thinking the disk or my prodding must have unaligned something. But nope, surprise surprise.... Success! So I want to share how it is indeed possible, even for an amateur "blind fisherman" into an IMac innards, like myself. I used a basic writing pad cardboard, as described, cutting out a handle and "hook", and went for it yet again. This time I was pretty sure it's at least possible, seeing so many videos. No tilting necessary, just my growing faith that the tiny card actually sits at the bottom of a compartment and hasn't floated off into the guts of the computer. I hit obstacles (by feel only), occasionally triggering a momentary ejection effort (whirring of the gears), but no luck there, it won't eject an SD disk. But... after another 5-10 minutes of trying to keep the hook towards the bottom and past the first thing it hit against, I felt like I was witnessing a live birth - suddenly I saw a tiny piece of SD card emerge. I immediately pincer-gripped it - I used my nails but a tweezers would have done nicely too. I got my card back, with precious images I'd saved, and a few I hadn't yet, as the card took a wrong turn first.
TAKE-AWAY - and this is the good part. Both the SD card - after months in the Mac - and the iMac itself (with months of SD card swallowed inside) are
perfect! I downloaded the few last images I'd not yet done when the slot swallowed my card, and tested the card in-camera. No ill effects! As for the iMac, I also tested, by reading from/writing to DVD, and it is as if the SD-card-swallow never happened. No need to lug it in to Apple, problem fixed. And lesson learned also: to be careful in the first place when putting an SD card in an iMac - visual confirmation for sure, as it's so easy to make this mistake.
It can be retrieved without damage, even by a manual-dexterity challenged person like me. Yes, the cardboard hook works, even when the card has moved further and further inside. Your mileage may vary, of course, but I wanted to add this here (rather than a YouTube comment) for others in this position.
Good luck!