The Talmud (Pesachim 54b) quotes R. Eleazar that a man is forbidden to dip his finger in water on Tisha B'av, and based on this statement the Tur (1275-1340, Orah Chayyim 554) rules that one cannot bath on Tisha B'av. The Shulchan Arukh (1488-1575, 554:7) follows the Tur, though he allows (554:9,10,14) one to wash to remove dirt, to do netilat yadim in the morning, and to wash one's feet if they are sore from travelling.
The Talmud (Ta'anit 30a) also has a discussion about whether it is permissible to bath on erev Tisha B'av after the seudat ha-mafseket, the final meal before the fast. The Rosh (1250-1327, end of paragraph 38) rules that it is permissible to wash one's self after the seudat ha-mafseket. The Meiri (1249-1306) notes that this passage in the Talmud is not recorded by the Rif and that there are people who permit bathing after the meal, but he thinks that is should be forbidden. The Tur (553) quotes the Ramban (1194-1270) who also thinks that it should be forbidden, but he rejects this approach based on his father's (the Rosh's) opinion that it is permitted. The Shulchan Arukh makes no mention of any prohibition and the Rama (16th century, 553:1) rules that it is permitted to wash one's self until sunset.
Accordingly, it would seem from the Talmud that it is permitted to bath during the nine days since it was only forbidden on Tisha B'av and possibly for some short time on erev Tisha B'av. However, in the period of the Geonim (9th, 10th centuries) restrictions on bathing began, and according to Gartner (1983, 1985) this development was due to the influence of the group called the Mourners of Zion who were almost definitely Karaites. The custom from the Geonim of not bathing prior to Tisha B'av developed differently in the Middle Ages between the Sefardim and Ashkenazim.
Rambam (Laws of Fasts 5:6) records that it was the accepted custom not go to a bathhouse during the week of Tisha B'av. Accordingly, R. Ovadiah Yosef (Yehaveh Da'at, vol. 1, p.109) writes that the only restriction for Sefardim is to bath with hot water during the week of Tisha B'av, but it is permitted to bath in cold water or to go swimming during the week of Tisha B'av.
On the other hand, in medieval Europe, R. Klonimos of Rome (d. 1096 in Worms, Germany, quoted in Gartner, 1985, pp.207-208) wrote that in Ashkenaz the custom was not to bath from the beginning of the month of Av. Similarly, the Tur (551) quotes from the Ravyah (Germany, 1140-1225) that the custom was not to bath from Rosh Chodesh Av, but he did not state whether the custom was just with regard to hot water or also for cold water. In the 15th century, R. Yisrael Isserlin (Terumat ha-Deshen, 1390-1460, Germany, quoted in Bet Yosef, Orah Chayyim, 551, Ketav Avi ha-Ezri) wrote that the language of the Or Zarua (Austria 13th century) and the Mordechai (Germany, 13th century) implied that one was not to bath even in cold water, though he remembered seeing people swimming in the rivers and nobody protested, and he concluded that one who is strict in this matter should be blessed.
This concluding statement by the R. Isserlin that it is preferable not to bath even in cold water became the standard practice of Ashkenazim for the next 400-500 (600?) years. The Rama (16th century, Darkei Moshe, 551) notes that the Ran (Spain, 1290-1375) writes that it is permitted to bath, but that the practice (of Ashkenazim) is that it is forbidden to bath. Similarly, in his comments on the Shulchan Arukh, the Rama (Orah Chayyim 551:16) writes that the custom (of Ashkenazim) was not to bath even in cold water, and that it is forbidden on erev Shabbat to bath except for one's face, head and feet in cold water, though he notes that some permit washing one's head with hot water if one is accustomed to do so.
Accordingly, the Sefardi and Ashkenazi customs with regard to bathing prior to Tisha B'av differ not only with regard to the time period of the restrictions, the nine days (Ashkenazi) as opposed to the week of Tisha B'av (Sefardi), but also with regard to the basic nature of the custom that the Sefardi custom only precludes bathing in hot water, while the Ashkenazi custom does not allow bathing even in cold water. The difference in the time of the custom is part of the general difference between Ashkenazim and Sefardim with regard to the prohibitions leading up to Tisha B'av, but why should there be a difference with regard to hot and cold water? Maybe this difference was due to different climates that since the Sefardim lived in more southern and hotter climates than Ashkenazim this made not bathing at all much more problematic in the hot summer. (See Sperber, 1995, pp.65-78 for a discussion of other possible customs that were influenced by differences in climate.)
Another possibility is that the acceptance by the Ashkenazim not to bath even in cold water was influenced by the cultural norms in Europe. In the end of the Middle Ages, there developed a general custom of not bathing in Western Europe due to a fear of diseases from the water. The Economist (The joy of dirt, 12/19/2009, Vol. 393 Issue 8662, p139-141) writes:
Paradoxically, it was fear of disease, including syphilis and the Black Death, that put water out of favour… By 1538, François I had closed the French bath houses. Henry VIII shut the "stews" of Southwark in 1546. Thus began an era when rich folk and poor rubbed along with dirt just fine. Even private baths were judged suspect. According to meticulous notes kept by Jean Héroard, the French court physician, the young Louis XIII, born in 1601, was not given a bath until he was almost seven…Indeed, bathing, certainly in hot water, was considered a veritable health risk. France's Henri IV was famously filthy, "stinking of sweat, stables, feet and garlic". Upon learning that the Duc de Sully had taken a bath, the king turned to his own physician, André du Laurens, for advice. The king was told that the poor man would be vulnerable for days. So a message was dispatched in forming Sully that he was not to go out, or he would endanger his health. Instead, he was told, the king would visit his Paris home: "so that you come to no harm as a result of your recent bath." In England, Elizabeth I bathed only once a month and James I, her successor, seems to have washed only his fingers. The myth of the danger of water was long-lived, and its demolition during the 18th and 19th centuries protracted. Louis XIV had sumptuous bathrooms built at Versailles but not, explains Mathieu da Vinha in "Le Versailles de Louis XIV", in order to clean the body. Valets rather rubbed his hands and face with alcohol, and he took therapeutic baths only irregularly. During the 19th century, germ theory combined with foreign trade, colonial administration and travel spread all manner of new ideas: hammams from Turkey and north Africa, "champu" (shampoo) from India, or bidets and olive-oil-based savon de Marseille from France. Water, and hygiene, were trickling back, and dirt was the new pest.
A "Jewish" proof of this practice not to bath is from the comments of the Magen Avraham (Poland, 1637-1683, 551:40) who writes that one should not treat this custom of not bathing in the nine days lightly since we are not regular bathers.
In the last two hundred years, even amongst Ashkenazi Jewry the practice has become to be lenient with regard to bathing, and this change accords with the change in western society's outlook on bathing. The Chayyei Adam (R. Avraham Danziger, 1748-1820, 133:19) writes that he thinks that a person who is accustomed to washing one's face, hands and feet with hot water every erev Shabbat can also do so on erev Shabbat in the nine days (Shabbat Hazon). This was a new development since the Rama had only permitted using hot water for washing one's head. Approximately 100 years later, the Arukh Hashulchan (Byelorussia, 1829-1908, 551:36,37) decried that people in his time were bathing in hot water (apparently their entire body) on erev Shabbat, but then he wrote that anybody who was dirty was allowed to bath even in hot water. Approximately 80 years later, R. Moshe Feinstein (US, 1895-1986) and Rav Yosef Henkin (US, 1880-1973, ordained by the Arukh Hashulchan) ruled that today one can bath with hot water on erev Shabbat since today we bath more frequently (quoted by R. Shimon Eider, 1978, p.13).
In addition, authorities have permitted bathing even when it is not erev Shabbat. For example, R. Chayyim David ha-Levi (Israel, Kitzsur Makor Chayyim, 96:21) permits workers who do physical work to bath. Similarly, R. Shimon Eider (p. 12) writes that, "if one is dirty or perspired, he may wash or bath to remove the dirt of perspiration." He also quotes R. Moshe Feinstein that one can swim for a short time to remove dirt and perspiration.
This leniency to bath to remove dirt marks a new development since previously the only exemptions from the prohibition had been if one had to go to the mikvah since this was a religious obligation, and was not considered as bathing for pleasure. However, there was no permission to bath to remove dirt and most likely that would have been considered bathing for pleasure. However, today because people bath more frequently, regular bathing is no longer considered as bathing for pleasure. If this idea is correct, then swimming, which is for pleasure (excluding instructional swim?) would still be prohibited, but all bathing would be permitted.
R. Hershel Schachter (America, 1994, p.198) quotes a more sweeping permission from Rav Soloveitchik that since today mourners for parents bath in the 30 day period of mourning, then one can bath during the nine days. Was Rav Soloveitchik also referring to swimming that it too would be permitted? If yes, then with this approach we have returned to the law of the Talmud that bathing is only prohibited on Tisha B’av itself.