Why do Indra and Ashura reincarnate? The anime tells us that Madara-Hashirama and Naruto-Sasuke are the reincarnations of Indra and Ashura. 

Why did they get reincarnated? For fulfilling what purpose?
There is a lot of debate that the reincarnation cycle began because Hagoromo knew that sometime Kaguya would be free of the Planetary Devastation seal, and restart the Divine Tree ritual which would consume human-kind. But that is just in terms of giving the plot a direction.
Scientifically speaking, energy can neither be created nor destroyed. All it can do is transform. Kaguya initially attained massive amounts of chakra/energy due to being a member of the Otsutsuki Clan, and that energy exponentially grew larger after she consumed the Chakra Fruit. When she had kids, which were Hagoromo and Hamura, they inherited part of her energy. After they sealed Kaguya, the only people who wielded destructive energies were Hagoromo and Hamura. But, Hamura left Earth to live on the moon to keep guard on Kaguya, and the older brother Hagoromo stayed on Earth, and then had two kids, Indra and Asura, who also inherited part of their parents energy. They then grew up and became able-bodied adults who could use Hagoromo's power of Ninshu, not Ninjutsu, as Hagoromo said. While Indra retained and focused the power to himself, and used it destructively, Asura, however, used it to help people, thus forming the earliest concept of Yin and Yang. They were beings wielding enormous power and when they died, their chakra/power were transformed into their reincarnates, and like how opposite poles attract, so were the reincarnates drawn towards each other.
It is also evident that Hagoromo could transcned his consciousness over time, as he did with Naruto and Sasuke. It was just that his chakra wasn't being transformed and remained as a silhouette over generations.