I'm going to guess that you don't normally spend much time inverted, which you may do while diving. If not inverted, at least with your head lower than your gut. The solutions to heartburn while diving are probably the same as for heartburn in general: keep your head higher than your gut (although that may not be optimal diving position), don't overeat, don't eat fried or fatty foods, don't fill your stomach with liquids (although that may hinder your proper hydration), and use an over-the-counter drug like famotidine (Pepcid).
You may want to pose the question in the medical forum to get an expert response, or search the posts of DocVikingo, TSandM, etc., to see if it's been addressed before.
This is actually a pretty common problem. I occasionally suffer from it myself, and I have often seen guest divers with it. The best solution I have found is simply not to eat before diving, and in particular not to eat between dives. It's common here to offer fresh fruit in the hour-or-so between consecutive dives, and for me that's a no-no. The issue is not to keep the head above the gut, but the entry to the stomach above its contents. Even so some will slosh up to the opening during diving, which is why the symptoms can gradually but inexorably get worse during a session of diving.
If anyone routinely has "indigestion", "heartburn" or acid reflux this is a serious matter that warrants medical attention, but when it is sparked only by certain activities, with diving being principal amongst them, you just need whatever short-term action is sufficient to quash the symptoms. I must try Pepcid myself - I've never so far in my life taken it.