Answered by Shaykh Faraz A. Khan
Question: There are jokes that have jarring or disturbing elements of absurdity, but don’t use curse words, sexual references, or Islamically disrespectful themes. One example are ‘dead baby’ jokes. (Q. How do you fit 50 babies into a car trunk? A. With a blender.). Are such jokes haraam?
Answer: Assalamu alaikum wa rahmatullah,
I pray this finds you in the best of health and faith.
The criteria for permissible joking is that it not contain a lie nor entail frightening someone. It must also be free of offensive ridicule or mimicking of another; backbiting; slander; insult; and cursing. All of these are unlawful.
Moreover, as you mention, it should not have an Islamically disrespectful theme, as it is unlawful to converse about what is immoral (al-khawd fil batil).
[Nahlawi, al-Durar al-Mubaha]
The example you provide does have an Islamically disrespectful theme: it is a joke about killing babies. Such a joke is impermissible.
And Allah knows best.
Checked & Approved by Faraz Rabbani