Let's look at the story from the Mahābhārata. Bhīṣma narrates this to Satyavatī after he has just told her he cannot break his vow of brahmacarya (by performing niyoga on her daughters-in-law):
Ādi Parva; Saṃbhava Parva; Ch. 97-98
O queen! In order to prevent Shantanu's lineage from becoming extinct, I will tell you the eternal dharma of Kshatriyas. Hearing this, after consulting priests and those wise ones who know about the dharma that should be followed in time of calamities, determine what is best for the welfare of the world.
Jamadagni's son Rama was angry when his father was killed and in his anger, the immensely illustrious one killed the king of the Haihayas. He sliced off Arjuna's 1000 arms. Then he again took up his bow to conquer the world. Using his wonderful weapons, the great-souled descendant of Bhargava used his arrows to exterminate Kshatriyas from the world twenty-one times. Then Kshatriya women everywhere had offspring through Brahmanas who were self-controlled. The Vedas clearly say that a son so born belongs to the one who accepted the hand. With dharma in their minds, they united with the Brahmanas. The world has thus seen the resurgence of the Kshatriyas.
In earlier times, there was a famous and wise rishi named Utathya. His wife was named Mamata and he loved her dearly. Utathya's younger brother was the immensely energetic Brihaspati, the priest of the gods. He desired Mamata and sought to unite with her. Mamata told her brother-in-law, who was most eloquent in speech, 'I am pregnant through your older brother. Therefore, desist. O illustrious Brihaspati! Utathya's son is in my womb and has studied the Vedas and the Vedangas there. Your semen is infallible and, therefore, this is not possible. Do not desire me today.' At these words, the immensely energetic Brihaspati could not suppress his desire, though he had achieved self-control. The desiring one united with her, though she did not desire him in return. When he spilt his semen, the embryo inside the womb said, 'O father! There is no room inside for two of us. I was here first and you have unnecessarily wasted your semen.' At this, the illustrious rishi Brihaspati was angry and cursed Utathya's son, who was in the womb. 'You have spoken at a time that all beings crave for. Therefore, you will enter a long period of darkness.' From this curse was born the rishi Dirghatama. He was Brihaspati's equal in great deeds and great energy. To extend Utathya's lineage, the famous rishi had sons like Goutama and others, all immensely famous.
But Goutama and the other sons were overcome by greed and delusion. They tied him to wood and threw him into the waters of the Ganga. 'This man is blind and old. Why should we support him?' Thinking in this way, the cruel ones returned home...
(Debroy, Bibek. The Mahabharata: Volume 1, pp. 274-276)
Note that Mamatā only says, I am pregnant through your older brother. Therefore, desist...Do not desire me today; she doesn't quote from dharma śāstras e.g., Manusmṛti 9.57-58 which prohibit either brother from approaching the other's wife during normal times. This means rules like these based on which we are now judging Bṛhaspati came much later.
The wife of the elder brother is, for the younger, a 'wife of the preceptor'; and the wife of the younger brother has been declared to be a 'daughter-in-law' for the elder.—(9.57)
If the elder brother has recourse to the wife of the younger, or the younger brother to the wife of the elder, they become outcasts, even though 'authorised,'—except in times of distress.—(9.58)
On failure of issue, the woman, on being authorised, may obtain, in the proper manner, the desired offspring, either from her younger brother-in-law or from a ‘Sapiṇḍa’.—(9.59)
So, to answer your question – Why did the Devas let Bṛhaspati be their guru even though he had sex with his brothers' wives? – it's because it was legal at one point.