It has nothing to do with economics or “affordability”. Leviticus 23:2 refers to the seven Jewish festivals, literally “appointed times,” also called “holy convocations.” These were days appointed and ordained by God to be kept to the honour of His name. The Jewish feasts are closely related to Israel’s spring and fall harvests and agricultural seasons. They were to remind the Israelites each year of God’s ongoing protection and provision. The Feast of Unleavened Bread followed immediately after Passover and lasted one week, during which time the Israelites ate no bread with yeast in remembrance of their haste in preparing for their exodus from Egypt.
Jews were commanded under the Mosaic Law to travel to Jerusalem to celebrate Passover, Shavuot and Sukkot. Here is a brief extract from a detailed article on Passover:
Together with Shavuot and Sukkot, Passover was one of the Three Pilgrimage Festivals (Shalosh Regalim) during which the entire population of the kingdom of Judah made a pilgrimage to the Temple in Jerusalem. In Israel, Passover is the seven-day holiday of the Feast of Unleavened Bread, with the first and last days celebrated as legal holidays and as holy days involving holiday meals, special prayer services, and abstention from work; the intervening days are known as Chol HaMoed ("Weekdays [of] the Festival"). Every family large enough to completely consume a young lamb or wild goat was required to offer one for sacrifice at the Jewish Temple on the afternoon of the 14th day of Nisan (Numbers 9:11), and eat it that night, which was the 15th of Nisan (Exodus 12:6). If the family was too small to finish eating the entire offering in one sitting, an offering was made for a group of families. The sacrifice could not be offered with anything leavened (Exodus 23:18), and had to be roasted, without its head, feet, or inner organs being removed (Exodus 12:9) and eaten together with unleavened bread (matzo) and bitter herbs (maror). One had to be careful not to break any bones from the offering (Exodus 12:46), and none of the meat could be left over by morning (Exodus 12:10 Exodus 23:18). Source: https://en.wikipedia.org/wiki/Passover
Apart from the fact that participating in these holy festivals was a command, we should perhaps realise they were also holidays. Nobody could work. Everybody got together with family and friends and had a really good time on the journey there and back. When Jesus was 12 years old, Joseph and Mary brought Jesus along on the trip to celebrate the Feast with them. Luke 2:41-52 describes how Joseph and Mary only discovered Jesus was not in the caravan some two days after they left Jerusalem! Probably less to do with parental negligence than the fact that this journey was a great excuse to catch up on events and everybody was having a really good time.
These religious festivals were a cause for celebration and, regardless of the time or the cost involved, they were also holidays. I suspect that people looked forward to these gatherings.
P.S. Going back 2,000 years we need to remember that Jewish people were probably more spiritually minded than today's materialistic society. Their lives revolved around God, whom they believed in. Also, family played a huge part in the lives of those people. That, of course, is an opinion, but it goes some way to explain why they would make the journey to Jerusalem to worship God. They probably looked forward to those holy days, just like some people look forward to Christmas or Thanksgiving.