Slavic languages separated regardless whether due to external or internal factors. Some separated despite being of same religion and culture (like West Slavic languages) and some remained unified despite different religion, culture and political history (like Serbo-Croatian).
In both Avar and Khazar Khaganate a Slavic language was the Lingua Franca, not the same language though since the two states were both geographically and temporally apart. Under the Avars the Common Slavic language spread into different parts of Central and South-Eastern Europe, while from these it spread into Eastern Europe. The Eastern southern dialect (that of Kiev) became then the Lingua Franca of the Khazars. The reason why a Slavic language was the LF in both cases is because of in the case of Avars it was the language of the lower class, the farmers and labourers, and the merchants and the majority of soldiers that fought under or together with the Avar elite.
In the case of Khazars, in which realm Slavic was relatively new language, it was the language of the merchants and soldiers, and it fast became the language of the labourers who colonized large empty lands of Eastern Europe, pushing the indigenous Uralic peoples deeper into the forests or mixing with them. The Khazars and other steppe people were not farmers and usually plundered them, but now Slavic colonists were under Khazar protection so they were more or less left alone. This was in the beginning, but in couple of hundred years the situation changed with the arrival of the Mongols.
The language of the Avars is not known and the Khazar language is only assumed to be Turkic.