h(t)=0 is the value of the function when the height is zero—on the ground.
So -16t²+32t+128=0=-16(t²-2t-8)=-16(t-4)(t+2).
Therefore t-4=0 or t+2=0, making t=4 seconds or t=-2 seconds. We reject the negative value because it points to a time before the cannon was fired. Therefore it takes 4 seconds for the cannonball to hit the ground target.