These were the days before the Hutts, before the Sand People, before Tattooine was a desert world, when the Jawas were the dominant and in fact only sentient life to be found, before they had spread their influence across the galaxy in their small way, bringing others there, depleting all natural resources, the atmosphere, everything.
Yoda saw all that coming because, of course, he was closely-attuned to the Force, which itself was strong on Tatooine. He became keenly aware that great disaster was coming to the Force, and he left his home world in order to discover the nature of this threat.
Before this there was no Jedi Order, nor Sith, any organized understanding of the Force at all. His main ally in establishing any such effort was a man named Palpatine, who was far more interested in exploring the limits of the Force than to, in fact, impose limits, which was the philosophical difference that drove them apart and started a feud that would last a thousand years. Palpatine had a master, and there were others who had knowledge and practice with the Force before them, but everything that followed came from them.
In time, Yoda forgot his roots, but only consciously. Subconsciously, his thoughts always returned to Tatooine. That was how he knew the prophecy of the one who would one day bring balance to the Force, a prophecy he himself had declared after forty days of deep meditation on an out-of-the-way swamp world called Dagobah, would be fulfilled by someone else from Tatooine. And all the while, his brethren among the Jawas, equally unaware of their role, would always be there to make sure events unfolded as they should.
That was why they spent time collecting assorted scrap and acting as merchants redistributing whatever goods made their way to Tatooine. All this was to guide them to the moment when an astromech droid designated R2-D2 would lead the Jedi savior to his destiny.
Yoda, his mind focused on other matters, had left Tatooine behind. Yet Tatooine hadn't forsaken him.