"War already marches on their own lands"
Answered by Legolas when posed the question by Gimli:
'The Lady of the Wood! She reads many hearts and desires. Now why did not we wish for some of our own kinsfolk, Legolas?'
Legolas stood before the gate and turned his bright eyes away north and east, and his fair face was troubled. 'I do not think that any would come,' he answered. 'They have no need to ride to war; war already marches on their own lands.'
The Lord of the Rings: The Return of the King, Book V, Chapter II; The Passing of the Grey Company
The host of Thranduil and Dwarves of Erebor (and arguably Men of Dale as well) already had their own problems to deal with. You're forgetting that Sauron also sent a Northern army to the Kingdoms of the North. Sauron could still send some of his armies to the North, even if his main one was concentrated on the South. To answer the part on Dain (and King Brand):
In the late summer of that same year (2941) Gandalf had at last prevailed upon Saruman and the White Council to attack Dol Guldur, and Sauron retreated and went to Mordor, there to be secure, as he thought, from all his enemies. So it was that when the War came at last the main assault was turned southwards; yet even so with his far-stretched right hand Sauron might have done great evil in the North, if King Dain and King Brand had not stood in his path. Even as Gandalf said afterwards to Frodo and Gimli, when they dwelt together for a time in Minas Tirith. Not long before news had come to Gondor of events far away.
'I grieved at the fall of Thorin,' said Gandalf; 'and now we hear that Dain has fallen, fighting in Dale again, even while we fought here. I should call that a heavy loss, if it was not a wonder rather that in his great age he could still wield his axe as mightily as they say that he did, standing over the body of King Brand before the Gate of Erebor until the darkness fell.
'Yet things might have gone far otherwise and far worse. When you think of the great Battle of the Pelennor, do not forget the battles in Dale and the valour of Durin's Folk. Think of what might have been. Dragon-fire and savage swords in Eriador, night in Rivendell. There might be no Queen in Gondor. We might now hope to return from the victory here only to ruin and ash. But that has been averted because I met Thorin Oakenshield one evening on the edge of spring in Bree. A chance-meeting, as we say in Middle-earth.'
The Lord of the Rings: The Return of the King, Book VI, Appendix A; Chapter III; Durin's Folk
To answer the part on Thranduil and build-on the part on Dale:
In the North also there had been war and evil. The realm of Thranduil was invaded, and there was long battle under the trees and great ruin of fire; but in the end Thranduil had the victory.
[...]
At the same time as the great armies besieged Minas Tirith a host of the allies of Sauron that had long threatened the borders of King Brand crossed the River Carnen, and Brand was driven back to Dale. There he had the aid of the Dwarves of Erebor; and there was a great battle at the Mountain's feet It lasted three days, but in the end both King Brand and King Dain Ironfoot were slain, and the Easterlings had the victory. But they could not take the Gate, and many, both Dwarves and Men, took refuge in Erebor, and there withstood a siege.
When news came of the great victories in the South, then Sauron's northern army was filled with dismay; and the besieged came forth and routed them, and the remnant fled into the East and troubled Dale no more.
The Lord of the Rings: The Return of the King, Book VI, Appendix B; The Tale of Years (Chronology of the Westlands)
The armies of Thranduil and Dain had no need to come to the Battle of the Pelennor Fields owing to the fact that "war already marches on their lands", which would mean that they were too preoccupied to send aid to Gondor.
Distance and method of travel also play important roles
- Distância
It is also worth noting that the Northern Kingdoms are at least milhas 600 away from Gondor. That's far. It'll have took a long time for the armies to even reach Gondor, and by that time Minas Tirith would be taken over. Not only that: why would you ride 600 miles to defend another person's city, when your own is being attacked?
- Method of travel
The host of Eorl came to the aid of Gondor back in the rule of the Steward Cirion. He started off in the North and reached Gondor by riding on horseback.
The Chronicle of Cirion and Eorl begins only with the first meeting of Cirion, Steward of Gondor, and Eorl, Lord of the Eotheod, after the Battle of the Field of Celebrant was over and the invaders of Gondor destroyed. But there were lays and legends of the great ride of the Rohirrim from the North both in Rohan and Gondor.
Unfinished Tales, Part Three: The Third Age, Chapter II, Part I;
The Northmen and the Wainriders
We don't know if Mirkwood or Erebor housed enough horses, but it would be really tiring to andar 600 miles, and don't forget you'd still have to fight a battle.