I think that Twain is trying to show at least a couple of things that he thinks are wrong with civilization when he writes about the King and the Duke.
One thing is that people are constantly trying to make others conform to what they think is "proper" behavior. I think that we can see this in the part where the King scams all the people at the camp meeting who are all eager to reform pirates.
Second, I think he shows how people try to act like they're moral but really want things they say they disapprove of (like how porn is a huge industry here in "conservative" America. This is best seen, in my opinion, in the part where they attract a huge crowd with their sign that says that no women and children are allowed.