Considering the abysmal accuracy Civil War troops on good ground displayed when firing at dense phalanxes of their opposing countrymen advancing at walking pace? The Fell Beasts are quite safe, particularly since as the for most of the battle they were a presence felt but not seen:
'The Nazgul came again, and as their Dark Lord now grew and put forth his strength, so their voices, which uttered only his will and his malice, were filled with evil and horror. Ever they circled above the City, like vultures that expect their fill of doomed men's flesh. Out of sight and shot they flew, and yet were ever present, and their deadly voices rent the air. More unbearable they became, not less, at each new cry. At length even the stout-hearted would fling themselves to the ground as the hidden menace passed over them, or they would stand, letting their weapons fall from nerveless hands while into their minds a blackness came, and they thought no more of war; but only of hiding and of crawling, and of death.'
*Emphasis mine
Having said that, if there was
any arm that could discomfit the designs of the Nine in this battle, it would be the artillery. As Ardant du Picq writes in his
Battle Studies, "Artillery in battle has its men grouped around the pieces, stationary assembly points, broadly distributed, each one having its commander and its cannoneers, who are always the same. Thus there is in effect a roll call each time artillery is put into battery. Artillery carries its men with it; they cannot be lost nor can they hide. If the officer is brave, his men rarely desert him. Certainly, in all armies, it is in the artillery that the soldier can best perform his duty."
However, it's questionable how much of a role even the artillery could play in the battle. Between the limited gun depression of most period gun carriages, the careful siege tactics of the attacking force, and the possibility that the space on the walls would be insufficient for the safe deployment of batteries as the recoil from fire rolled cannon back significantly after any particular shot, any direct fire pieces the Union army has with them may be unable to participate to any significant degree. Their effect on events requires some assumptions. Depending on when it is that the Union army arrived and their willingness to take advice they could commit to digging earthworks with their backs to the walls of Minas Tirith, with a grand battery in Napoleonic style under Gandalf's direct influence as much as possible. This hornet's nest of firepower would significantly harm the Black Captain's devices, slowing the Enemy as they pour over the Pelennor fields for as long as their ammunition and will holds and particularly preventing the deployment of the many engines that had been prepared.
However the power of the Nine only grew over the course of the battle and even those working the guns will begin to fail the test. As their fire slackens so too will all hope. It is however not beyond possibility that they manage to hold firm until morning as opposed to the original defense of Gondor, which collapsed just before sunrise, if the Witch King shies away from the Union army's firepower. He might not, and therein is the risk. With his will driving them and the general obedience to drill the orcs and uruks in his army displayed, they may instead mask themselves as best they can with the rolling terrain and press the attack.