The narrator is watching another soldier who has inhaled mustard or chlorine gas choking to death as he coughs up blood and fluid from his lungs. He seems to be "drowning" because he can't breathe, given the liquid that he is "gargling."
"Dim through the misty panes and thick green light / As through a green sea" depicts the view the narrator has as he watches the man through his gas mask. The gas shell that was dropped has created a green cloud around the soldier, and furthermore, the gas masks often had green glass in them, glass that was often wavy because it wasn't of the best quality. Seeing through the glass in the gas mask the suffering soldier flounder as he gags on his own blood, the narrator describes him as "drowning" because he seems to be underwater and dying from the effects of the gas.
In terms of what this line represents in the poem, it describes a particularly horrific death that leads the narrator to the conclusion that the notion that "It is sweet and fitting to die for one's country" is a lie. The narrator, a young soldier in World War I, sees a fellow soldier who fails to put on his gas mask in time when chlorine gas is dropped. As the soldier's lungs burn, they fill with blood, so that he is actually drowning in this liquid. However, this death is not a quick one; it is the stuff of nightmares--the narrator's nightmares.
When the gas clears, they put the soldier's body in the back of a wagon. Still, he is not dead. The narrator says, essentially, that he can "hear, at every jolt, the blood / Come gargling from the froth-corrupted lungs" as the man's life slowly, painfully ebbs away. The only way there could be "froth" or "gargling" is if the man is still alive and attempting to breathe. And this image, of the soldier's eyes rolling around in the sockets and the froth bubbling from his mouth, bloody from the burns deep inside his lungs, compels the speaker to conclude that it is neither sweet nor fitting to die in such a way, not even for one's country. War is a bloody, terrible business that none but those who have experienced it can understand, and so the speaker, having witnessed the death in the line you cite, dismisses the romantic notion that death in war is somehow lovely and poetic.