Historically, many societies have encouraged unmarried men and women to lead separate lives. This was done because of lack of birth control. Religious leaders often encouraged this behavior to keep men and women from being intimate before marriage. Cultures with these rules generally found it necessary to invent ways for men and women to meet socially. In Europe, this was accomplished on the dance floor. Men and women could meet there without regard to social expectations.
While many formal dances are part of religious ceremonies, formal dancing in Europe was a social activity. Couples on the dance floor were expected to dance closely. These dances, even for adults, were well chaperoned. Physical intimacy was not the goal here, but intimacy for talking was expected. Couples on the floor learned to ignore each other. They could have a private conversation during the dance. This was not possible in many venues of the time.
Many European musical pieces and their dances were slow dances. This gave couples an opportunity to save their breath for speech. Flirting during dancing was almost an art form. A good conversationalist that could dance well was a popular person at formal functions. There were also imported dances such as the Tango. This was a wildly erotic dance where couples could display their intimate side in public without fear of reprisal from society.
In the modern world, this type of dancing may seem ridiculous. Couples today have a wide range of opportunities to be alone together. Even teenagers, usually closely chaperoned by parents, have the ability to create these types of opportunities. In historical Europe, a woman's reputation could be shattered if discovered alone with a man other than her husband. A gentleman would never sully a woman's reputation in this manner. That is why couples were eager to find a way to converse privately in public.