The movie begins when Harry and Sally finish college at the University of Chicago and are off to New York to begin their careers. The movie records a couple of snippets of their conversations during this trip, which center on male-female relationships. During one such conversation, Harry states this rule, "men and women can't be friends because the sex part always gets in the way." In New York, they depart less than friendly.
Harry and Sally meet five years later in a New York airport, and find themselves on the same airplane. Both are in relationships. During this encounter, Harry elaborates on his previous rule:
"…They can't be friends…unless both of them are involved with other people. Then they can. This is an amendment to the earlier rule. If the two people are in relationships, the pressure of possible involvement is lifted. That doesn't work either. Because what happens then is the person you're involved with can't understand why you need to be friends with the person you're just friends with, like it means something is missing from the relationship and wanted to go outside to get it. Then when you say, 'No, no, no, no, it's not true, nothing is missing from the relationship,' the person you're involved with then accuses you of being secretly attracted to the person you're just friends with, which you probably are—I mean, come on, who the hell are we kidding, let's face it—which brings us back to the earlier rule before the amendment, which is men and women can't be friends."
Again they separate less than friendly.
Five years later, Harry and Sally meet again in a New York bookstore. By now, their earlier relationships have ended.
To this point only about 30 minutes of the movie has elapsed, the remainder of the movie covers their relationship during the next two years as they become very close friends. During this period, the two are not romantically involved with each other, but are actively dating others. Their conversations during this period explore the topics of relationships and sex.
Eventually, they have sex with each other, which becomes a barrier to their friendship; a barrier that is overcome by the end of the movie. Courtesy of http://en.wikipedia.org/wiki/ When_Harry_Met_Sally