LDS missionaries are instructed to not go swimming. Commonly, this idea is misunderstood to be for the entire Mormon population, which is untrue.
That interpretation is "Mormonlore" which, I believe, spawns from a careless reading of D&C 61 (also see the section heading):
3 But verily I say unto you, that it is not needful for this whole
company of mine elders to be moving swiftly upon the waters, whilst
the inhabitants on either side are perishing in unbelief.
4 Nevertheless, I suffered it that ye might bear record; behold,
there are many dangers upon the waters, and more especially hereafter;
5 For I, the Lord, have decreed in mine anger many destructions upon
the waters; yea, and especially upon these waters.
6 Nevertheless, all flesh is in mine hand, and he that is faithful
among you shall not perish by the waters.
The context is that of early missionaries traveling by boat to their assigned areas of labor. Here the Lord is reminding them that they ought not pass by all the people along the river on their way up, and that instead they should go preach to them on the way. This is not unlike missionaries today who drive from appointment to appointment... most are encouraged to stop and talk to people along the way.
Later in the section:
14 Behold, I, the Lord, in the beginning blessed the waters; but in
the last days, by the mouth of my servant John, I cursed the waters.
15 Wherefore, the days will come that no flesh shall be safe upon the
waters.
16 And it shall be said in days to come that none is able to go up to
the land of Zion upon the waters, but he that is upright in heart.
The Doctrine and Covenents has a footnote in these verses to Rev. 8:10 (8–11).
So really, this is only repeating what is already in the Bible, that the waters will be a means of scourge before the Jesus' second coming, except to those people who are righteous which will be spared.
There is no teaching in the LDS church that says, "You shouldn't go swimming." Yes, they preach modesty even in swimming suits as much as possible and practical, but this isn't to say that swimming is evil or anything of the sort.
Missionaries are given particular instruction to not swim as it isn't consistent with the nature of their call, and there have been accidents -- and the Church doesn't want to have to deal with those issues.
As an aside, and perhaps an interesting corollary, there is the incident with Zion's Camp which happened a couple years after this revelation was received, which typifies the power of God, especially related to these promises given here about destruction with the waters, and protecting His servants.
From the Church History Institute Manual, Chapter 12, "Zion's Camp":
Instead of reaching their intended destination of Liberty, they camped
just inside Clay County on a hill between two branches of the Fishing
River. When Joseph learned that mobs were preparing to attack, he
knelt and prayed again for divine protection. Joseph’s fears were
confirmed when five armed Missourians rode into camp, cursing, and
swore that the Mormons would “see hell before morning.”
They boasted
that nearly four hundred men had joined forces from Ray, Lafayette,
Clay, and Jackson counties and were then preparing to cross the
Missouri River at Williams Ferry and “utterly destroy the Mormons.”
Sounds of gunfire were heard, and some of the men wanted to fight, but
the Prophet promised that the Lord would protect them. He declared,
“Stand still and see the salvation of God.”
A few minutes after the
Missourians left, a small black cloud appeared in the clear western
sky. It moved eastward, unrolling like a scroll, filling the heavens
with darkness. As the first ferry load of mobbers crossed the Missouri
River to the south, a sudden squall made it nearly impossible for the
boat to return to pick up another load. The storm was so intense that
Zion’s Camp abandoned their tents and found shelter in an old Baptist
meetinghouse nearby. When Joseph Smith came in, he exclaimed, “Boys,
there is some meaning to this. God is in this storm.” It was
impossible for anyone to sleep, so the group sang hymns and rested on
the rough benches. One camp member recorded that “during this time the
whole canopy of the wide horizen was in one complete blaze with
terrifying claps of thunder.”
Elsewhere the beleaguered mobbers
sought any refuge they could. The furious storm broke branches from
trees and destroyed crops. It soaked and made the mobbers’ ammunition
useless, frightened and scattered their horses, and raised the level
of the Fishing River [30 feet], preventing them from attacking Zion’s Camp. The
Prophet recalled, “It seemed as if the mandate of vengeance had gone
forth from the God of battles, to protect His servants from the
destruction of their enemies.”
The whole chapter is interesting history. See this for more information.