"Never fight a land war in Asia" is one of those weird aphorisms that is widely known, but on which nobody agrees who originally said it. It has variously been attributed to Bernard Montgomery (British General), Dwight Eisenhower (American General and later President), and Douglas MacArthur (American General).
The line was in the original book by William Goldman which was published in 1973. At the time, the US was trying to extricate itself from the Vietnam War. Many Americans thought the war a terrible mistake, and "Never fight a land war in Asia" was a frequently heard "obvious truth". A significant fraction of the viewers of the 1987 film would have clear memories of that period of American history.
As @ToddWilcox notes in a comment, the line worked as humor (at least back then) because it brazenly breaks the fourth wall and inserts a highly topical meme from the "real world" into a fairy story where it makes no sense: there is no indication of Asia even existing in the world of The Princess Bride.
As the origins of the quote lapse into obscurity, the humor of it may begin to fail.