Everyone downvoting this doesn't understand comedy. So some comedians make (for example) Holocaust jokes. They are careful about doing it in a way that doesn't disparage Jews, even though it might be shocking, off-the-cuff sounding, &c. Professional comedians can do this because they're experts at telling carefully crafted and targeted jokes in a way that sounds natural. It might be very shocking, but not shocking in a way that fosters racist feelings in the audience.
If a comedian showed up to a mic and started making the sort of Holocaust joke that an insensitive person would make after a few beers, they might get some laughs, but laughs aren't the goal--the goal is to have a good set that people like and remember. Their set would likely flop and they would likely not invited back. I dabble a bit in comedy and, yes, I have seen this happen.
This example holds for most sensitive subjects. So no, it is not acceptable in comedy to say anything for the sake of getting a laugh.