I agree with Imnvs: ducks usually jump into the water when they are on the tiles next to the water body. Randomly.
This means, they don't decide to go swimming and then follow a path until the closest water. This is a random decision when they are next to water: if the game decides the duck has to move, instead of considering the water as an obstacle, it will make the duck jump into the water (maybe after a roll dice). And this is the same logic for jumping out of the water.
So if you want your duck to swim, you have to maximize their opportunities to be on the bank of the river/pond.