Assuming the temperature in a whale remains about the same, the volume of the ideal gas in inversely proportional to the pressure. At great depth where the pressure is 1000 times what it is on the surface, the ideal gas is compressed to 1/1000 of its volume. Fart gas might not be the ideal gas, but it acts like an ideal gas. Assuming intestinal gas production continues at the same rate at great depth as on the surface, after half an hour there will be a fair amount by weight but at small, insignificant volume. When the whale comes back up, the gas expands by a factor of 1000. That's when it has to let go. A whale ascent from the deeps is accompanied by a great deal of farting and burping. The real question is whether the whale surfaces ahead of or later than the bubbles.