There are lots of apps that can export messages to HTML and other formats, but after doing some searching I didn’t find any for markdown. I know SMS are mostly text but markdown is a plain text file format which support text formats like bullets, headings, and media (usually by referencing image, video, or audio files in the same folder or in a sub-folder). That would be nice for reading and searching through in apps like Obsidian.
SMS are text-only. If you want to convert them to MD, you just need to handle newlines and escaping whatever sequences trigger Markdown formatting.
MMS and RCS are a whole another story.
Export to HTML, use pandoc (or sed/awk) to convert to markdown.
I use BeautifulSoup and markdownify for selective HTML to MD in Python.