Pilots and other military types say “roger” to acknowledge receipt of a message or instructions. “Roger” at one time was the phonetic designation for the letter R, which in turn stood for “received.” Why not just say "received"? From a safety perspective, it makes sense to use standardized language, particularly when dealing with international operations. An American pilot may not understand German, but they both understand aviation terminology. The International Civil Aviation Organization oversees this standardization and disseminates it accordingly.
The use of “roger” isn't all that old. In the military's phonetic alphabet, "roger" didn't become the designation for R until 1927. (Previously the designation had been "rush.") The first citation given by the Oxford English Dictionary for “roger” in the sense of "received" dates from 1941, coinciding with U.S. entry into WWII. The term made the big time in 1943, when the Army Signal Corps incorporated it into one of its procedural manuals.
In 1957 "roger" was replaced by "romeo," the current designation, but by then "roger" = "received" was so entrenched that the brass knew better than to try and change it.
As for the use of “roger, roger” in Phantom Menace, the consensus seems to be that it's a sly (OK, not that sly) reference to Airplane (1980). The co-pilot in the latter movie, played by Lakers legend Kareem Abdul-Jabbar, was named Roger Murdock. This was the pretext for such lines as:
Captain Oveur (Peter Graves): Roger, Roger. What's our vector, Victor?
Variations on this theme include Oveur/over and clearance/Clarence. Trust me, it's pretty funny in the movie.
As for Roger’s last name, “wilco” dates from the same time, and is simply an abbreviation of “will comply.” So the pilot who invokes our friend Roger Wilco is saying “I understand you, and will follow your instructions,” only cooler and shorter.
Sources
Department of the Navy, “Phonetic Alphabet and Signal Flags” (2001), accessed from http://www.history.navy.mil/faqs/faq101-1.htm on November 7, 2006
Oxford English Dictionary, “Roger” (1989), accessed from http://dictionary.oed.com/cgi/entry/50208035?query_type=word&queryword=roger&first=1&max_to_show=10&sort_type=alpha&search_id=x623-4WoeC3-13752&result_place=1 on November 7, 2006