Only the years we had a Mishkan (year 2 of the Exodus) through a few years after Shelomo's reign.
Rashi (Qoheles 1:1) quotes a tradition that Shelomo haMelekh calls himself Qoheles at the beginning of the book because he saw through Ruach haQodesh that he would be the only king -- until the messianic one -- to perform the mitzvah of haQhel. The mitzvah required a king, a BHMQ, and that it be Sukkos the year after shemittah. Everyone gathered to hear the king read parts of sefer Devarim. Since there was no BHMQ until Shelomo, he was the first able to do the mitzvah.
Shelomo haMelekh died and the 10 now-lost tribes of the north were tired of paying taxes and putting in mandatory service to the state to support a capital and Beis haMiqdash (BHMQ) so far from home. They broke away under their own king, Yeravam ben Nevat, and formed the Northen Kingdom, Malkhus Yisrael. Yeravam ben Nevat created his own variant of the religion -- actually more like a variant of the Golden Calf religion -- with its own two Temples.
By the next chance to do haQhel, Rechavam, Shelomo's son, king of the southern Malkhus Yehudah, was given the Torah. He was allowed to sit while reading, but the only person allowed to sit in the Beis haMiqdash is the Davidic King. Yeravam ben Nevat was offended that Rechavam was permitted to sit while he had to stand. This was the final break. Along with this religion and disconnection from the Beis haMiqdash, Yeravam made it illegal for his citizens to go to the southern kingdom, Malkhus Yehudah. So, the majority of the Israelites would be taking their lives in their hands to go on aliyas haregel.
Meaning the haQhel after Shelomo was the last time that Malkhus Yisrael, the majority of the Benei Yisrael, were able to visit the Beis haMiqdash.
But the remaining Jews did practice aliyah laregel all through the second BHMQ.
The question of safety is interesting. They had no enemies during Shelomo's reign, but even after the breakup, safety would be an issue -- it's not like Malkhus Yisrael was standing watch ready to help Malkhus Yehudah, nor did the lost tribes help the Jews of the Second Temple era. While it's nice to think Hashem kept us safe miraculously, there are lists of miracles that occurred at the BHMQ, and I never saw this one. E.g. Pirqei Avos 5:7, which includes the fact that no one ever complained about a lack of space, implicitly about aliya laregel -- when the number of visitors was at its peak.
I would conclude, therefore, that security simply trumped the mitzah of aliyah laregel -- not everyone in active service got leave for the holiday.