Many people generally assume that the only connection between Parshas Beshalach and its Haftorah, which features the song of Devorah, is that Az Yashir, sung by Bnai Yisrael after Kerias Yam Suf, and Shiras Devorah are both written in song form. However, the connection between the two sections of Tanach is in fact deeper. After all, if all we cared about here was the Song of Devorah, the Haftorah should start with the fifth Perek of Shoftim, where the Song begins, as is indeed the practice of the Sephardim. However, the Ashkenazic custom is to start the Haftorah a few Pesukim into the fourth Perek, which describes the start of the Jews' redemption. Obviously, there is a connection as well between the redemption from Egypt
and the redemption from Chatzor in the days of Devorah.
To begin with, we must understand the situation of the Jewish people in each of these stories. In both cases, the Jews were being oppressed by powerful foreign rulers. Each time, Hashem instructed someone to go lead the Jews to freedom. Moshe declined the offer to save the Jews until Hashem gave him Aharon as a partner, so too, Barak agreed to lead the Jews in battle only if Devorah would accompany him. Moshe and Barak both lost some of their glory for this. Moshe lost the opportunity to be the permanent religious and political leader of the Jews, because Aharon ended up getting the Kehunah as a hereditary gift, and Moshe was left as a political leader whose position was passed on to whomever Hashem chose next, rather than to his children. Barak lost the opportunity of killing the enemy general to a woman who wasn't even fighting in the war.
However, the exact parallels between the two events end once the action starts. At the time of Yetzias Mitzrayim, Hashem made what could have been a simple process of taking the Jews out in one day into a process designed to make Paroh look foolish, which was drawn out over 10 plagues in Egypt plus the events of Kerias Yam Suf. In the story of Devorah and Barak, however, there are no ten plagues and the action goes straight to the equivalent of Kerias Yam Suf. In the only "plague" Hashem issues to Chatzor, all the soldiers are killed except for the general. This is like Kerias Yam Suf, where the Torah tells us that every Egyptian died (שמות י"ד;כ"ח). The Mechilta (שם) states, however, that Paroh saw everyone else die first before dying. We thus see that Hashem brought about the same result in Yetzias Mitzrayim and in Barak's reconquest of Israel; the miracles, however, were totally different. In the latter event, Hashem used no "fireworks." He seemingly had no interest in embarrassing Yavin or Sisra, the leaders of Chatzor, the way that he did Paroh. All He wanted to do was engineer a massive victory and redeem the Jews. Furthermore, following this military victory, Hashem didn't need to bring any more miracles to give the land of Israel to the Jews, unlike by Yetzias Mitzrayim, where Hashem needed several more miracles in order to give the land to its appropriate owners.
Perhaps because these events were so similar, and at the same time the miracles involved were so different, Chazal chose this song (as opposed to other songs in Navi like that of Dovid HaMelech) as the Haftorah for Parshas Beshalach. In the case of Yetzias Mitzrayim, the Jews weren't enslaved as a punishment. Rather, all the events from the famine in the days of Yaakov and Yosef until Yehoshua's conquest of the land were a set-up for Hashem to fulfill His Bris with Avraham by bringing the Jews into Israel and destroying the Canaanite nations, who by this time were ready to be destroyed (עיין בראשית י"ג;ט"ז). As a part of this Bris, Hashem promised "וגם את הגוי אשר יעבודו דן אנכי","I will also judge the nation for whom they work as slaves" (שם). In order to fulfill this, He judged Paroh and beat him מדה כנגד מדה, measure for measure, paying him back precisely for each thing he had done. This explains the need for the drawn out process of punishing Paroh and his nation with overt miracles. In the case of Barak, however, Hashem wasn't bound by any Bris, because the Jews had abandoned their part of the Bris by not fully destroying the Canaanites in those days. Hashem thus had no reason to perform overt miracles, or to embarrass the people of Chatzor in any way.
This is perhaps another reason why the episode of Devorah and Barak is so important to read on the same Shabbos that we read of Hashem giving Mitzrayim the knockout punch. The story of the war with Chatzor reminds us that if we want Hashem to give us good lives and perform miracles on our behalf, we must recognize that any Bris which we have with Hashem is a two-way street. After all, the Jews of that era failed to recognize that their victory required them to thank Hashem by keeping Mitzvos even without their land being occupied by enemy troops. Only 40 years later, they were conquered by Midyan as another punishment. We must realize that in order for Hashem to be the "Shomer Yisrael," guarding us, we must be "Shomrei Torah Umitzvos,"guarding the Torah and the Mitzvos.