Is there any basis (in Halacha or otherwise) for the custom to sit shiva for somebody who intermarried or converted to another religion?
While I don’t know if this is the custom or not, however here are some sources for this.
It is brought in Hagahos Ashrei (Moed Katan 59), (also brought in Mordechai Moed Katan 886), that Rabeinu Gershom sat shiva for his son who converted. There are different opinions among the poskim if this was when he actually converted or if it was only when he died without doing teshuva (Taz Y:D 340-3). Others (Levush) say that he did this only to show his pain, but not that this is obligatory. It is however correct for one to cry and be pained by this (see Sefer Chasidim 190), because if we are pained by the loss of one’s body, how much more so by the loss of his soul.
May we never know from such sad things.