To expand on what Yellowhand has said, everytime the engine fires, it sends out a pusle of exhaust through the valve. This pusle, (ball), of exhaust travels down the pipe, being pushed by the firing that came behind it. Baffles, or a baffle, create(s) a blockage for the ball to push against. As they force themselves past the blockage, they create backpressue. This, in turn creates a vaccuum that is carried back up to the valve. This suction draws the next pusle out as the exhaust valve opens. The better the vaccuum, the better the scavanging of gases from the cylinder. To a degree, of course. Everthing has a limit. Stock mufflers create a traffic jam and almost negate the scavanging effect.
For what it's worth, no knowledgeable performance oriented Harley rider would run drag pipes on a street bike. No baffles, no backpressure. Each exhaust ball just kind of breaks up and floats out the pipe. This creates a loss of power until the engine reaches the upper regions of the RPM range. Only then can it fill the pipe enough to begin to create the needed vaccuum. But, a simple fender washer, placed in the tail of the pipe, can be tuned to create a very good broadband performance pipe. Just that little bit of backpressure is all it takes.