According to the timeline of the shoftim in the Artscroll Tanakh (supposedly based on the Vilna Gaon), Barak and Devorah served as judges of Israel at the same time. Why was it necessary for them both to be shoftim?
The Tanna D'vei Eliyah Rabbah 9 writes:
וכי מה טיבה של דבורה אצל ברק והלא דבורה במקומה וברק במקומו אלא כך אמרו חכמים ברק היה משמש את הזקנים בחייו של יהושע וכן חזר ושמש לאחר מיתתו לפיכך הביא הקב"ה אותו ונתן אותו אצל דבורה
Because what is better than Devorah besides Barak? Is it not (better) Devorah in her place and Barak in his place? Rather the Sages say that Barak served the elders in the lifetime of Yehoshua, and similarly he returned and aided them after his (Yehoshua's) death. Therefore, Hashem brought him and placed him beside Devorah.
So aside from being married, (as has been mentioned) which anyway ensured that they were in close proximity to one another, they also conceivably complemented one another from a judging perspective.