How Group Battles Work
A number of people can attack a gym at the same time. You can see the other attacking pokemon in the background and sometimes an icon with a number.
When I tried this with my gf and with both screens in view it appeared that we weren't applying damage at the same time and the defender was killed much quicker on one of the devices. When this happened the remaining HP bar on the other device quickly hit 0 and we both moved on to the next defender.
It appears you don't apply damage at the same time but once one player has beaten the defending pokemon it is defeated for everyone.