When Sonic is underwater he moves much more slowly, but otherwise his physics are largely the same. This is achieved mostly by halving the pertinent variables, but some, like gravity and initial jump velocity, are not exactly half.
Acceleration has a value half that of normal: 0.0234375.
Deceleration has a value half that of normal: 0.25.
Rolling deceleration remains unchanged.
Friction has a value half that of normal: 0.0234375.
Rolling friction has a value of 0.01171875.
Sonic's top running speed is 3, half that of normal.
Sonic's air acceleration behaves the same way, but has a value of 0.046875, half that of normal.
Gravity is 0.0625, instead. This causes Sonic to fall much more slowly.
Inital jump velocity is equal to -3.5 (-3 for Knuckles), and release velocity is equal to -2.
When Sonic gets a bubble underwater, his X speed and Y speed are both set to 0.
When Sonic hits the water, his X speed is multiplied by 0.5 and his Y speed is multiplied by 0.25 (this occurs after gravity is added). Conversely, when Sonic leaps out of the water, his Y speed is doubled (after water gravity has been added), so that he begins moving faster now that water no longer impedes his movement (however, X speed is not affected when leaving the water).
When Sonic drowns, his X speed and Y speed are both set to 0, and the water gravity remains normal.
When in possession of Speed Shoes, but also underwater, the underwater variables take over, effectively nullifying the Speed Shoes altogether. No calculations, such as multiplying by 0.5, take place.
Being submerged doesn't affect the speed of Sonic's animations at all. Animations whose speeds are proportional to variables which are otherwise affected, such as Sonic's velocity, will be attenuated by the same proportion automatically.