When appearing at the Temple on this thrice-yearly pilgrimage, the travelers were not to show up empty-handed. They were to bring the animal for the olas r’iyah, the burnt offering made upon appearing at the Temple, as we described in the previous mitzvah.
As we described in Mitzvah #489, the Festival pilgrimage kept every family involved in Temple activities. That would be kind of hard to do if one neglected to bring something to offer! Besides, it’s just rude to show up at someone’s house (or, in this case, House) empty-handed.
This mitzvah only applies to men, in Temple times. In the Talmud, is the first topic discussed in tractate Chagigah. It is codified in the Mishneh Torah in the first chapter of Hilchos Chagigah. This mitzvah is #156 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos.