Fluid accumulation in the abdominal cavity (around the organs) is called "ascites". The old-timey name for it was "dropsy". Right-sided heart failure can certainly cause it. There are other things that can cause it, as well.
Cancerous growths in the abdomen can secrete fluid. The first sign of my mother's ovarian cancer was the fluid build-up. Starvation can cause it. The plasma protein albumin is a big molecule that helps hold fluid inside the blood vessels. They seep fluid without it, which is why those starving refugee kids (that you quickly skip past when channel-surfing) have such big bellies. Without protein, they can't make albumin; that big belly doesn't mean they just got their CARE package. If your liver is failing, it can't use the protein you have to make albumin, so that's another possible cause of ascites.
Hemorrhage from a ruptured spleen or urine from a ruptured bladder may fill the abdomen with fluid, but you'd have a lot of other things going wrong as well.
Since heartworms reside mostly in the pulmonary arteries (taking blood through the lungs to get oxygen), they are the most common cause of right-side heart failure in dogs. The arteries filled with worms create too much work for the heart to pump against, and it wears out from constant overwork. It becomes enlarged because the weakened muscle gets "flabby" and stretches out of shape. Now it can no longer contract forcefully, and blood that should be getting pumped forward gets backed up in the great veins returning blood to the heart from the rest of the body.
This back-pressure causes the veins to seep water like a canvas hose, and fluid accumulates in the abdominal cavity. Ginny, here, does not have heartworms, but has (for unknown reasons) developed right-sided heart failure at a very young age. She doesn't look too bad from the side view above, but she is carrying about three gallons of unwanted fluid on her abdomen. From the top view you can get a better appreciation for the amount of abdominal enlargement she has.
Medications can help the failing heart by decreasing its workload, such as diuretics (i.e. Lasix or furosemeide, spironolactone) to reduce fluid loading, and vasodilators (such as enalapril) to decrease the resistance in the blood vessels, and pushing the heart muscle a little harder (pimobendan, and the old standby digoxin). Ginny is taking all of these, but it doesn't prevent the fluid build-up. It's not too bad for a couple of weeks, but then she hits a "tipping point" and it balloons out of control. We try to catch it before this point, but the big ice storm and two-week power-outage messed up our schedule.
And here's Ginny, 24 pounds lighter, feeling good and looking a lot different. Once that fluid is out, she feels pretty good. She can't tolerate any strenuous exercise, but she has a good quality of life. Pretty great for someone the cardiologist predicted would succumb by last October. Her owner's devotion to getting all her meds on time, twice a day, every day has made the difference. That and a few trips to the draining station.