Gas (or flatulence as it is medically known) is a common problem and / or question for many patients. Given the sensitive nature of the subject, patients often defer asking their doctors. If you are experiencing significant gas then I would recommend discussing this with your doctor
as this can be a sign of serious illness.
Gas development is a normal process. Gas is formed by the bacteria that normally live in the colon. As food transits through your bowel--much of it is broken down and absorbed. There are some foods (like types of fiber) that we can't digest. When these undigested substances get to the bacteria in the colon, they go ahead and digest it. The byproduct of their digestion is the gas.
In general, there is no known medical harm to holding your flatulence. In general, the gas can be maintained in the colon without significant problem. Keep in mind that your colon and small intestine are longer than 30 feet!! That is to say, they can hold a lot of gas and therefore are not likely to burst open if that is your concern.
A caveat to that...if you are unable to pass gas despite trying (known as obstipation) this is a significant concern as it could be consistent with a bowel obstruction.
Discuss your concerns with your doctor.