It's just a part of the traditional hamburger. http://en.wikipedia.org/wiki/Hamburger
The first person to ever start putting a juicy ground beef patty in between two buns probably just really liked pickles and thought their salty/twangy flavor would be a good compliment...and it stuck!