In theatre slang, breaking the fourth wall refers to when a character suddenly looks away from what's happening in a movie and turns directly to you (the audience) to say something. This is something we see whenever Sheriff Bart turns to us and says something like, "Oh Baby, you are so talented. And they are so dumb." In other words, Bart is letting us in on the fact that only he and the audience understand just how dumb all the other characters are.
By the end of this movie, Mel Brooks doesn't just break the fourth wall figuratively. He literally demolishes it when his characters go so crazy that they break onto the sets of other movies. This is Brooks' way of constantly reminding us that we're watching a movie and that none of it is real, which makes it a whole lot easier to laugh at all the terrible racism and violence that's been happening.
By the end of the movie, we've been bombarded by so many different characters living in different realities that we actually find Hedley Lamarr hanging out in a theatre and watching the exact same movie we are—Blazing Saddles.
The whole thing is just wacky, but in a good way. That's why audiences today still flock to this movie to have a good laugh. In some ways, you could even say that this comedy—with its on-the-nose social commentary and its meta elements—is a lot more edgy and clever than 99% of comedies made forty years later.