It is in fact a communal obligation; whoever undertakes the pursuit of knowledge is rewarded as one who fulfills an obligatory duty, and the reward for an obligation is greater than that for a voluntary act. In the sound ḥadīth Allah, exalted is He, says: “My servant does not draw near to Me with anything more beloved to Me than what I have made obligatory upon him.” Thus, seeking knowledge is a collective duty: when a single individual discharges it, he fulfills the obligation on behalf of the entire community. At times, however, it becomes a personal duty when a person himself needs that knowledge—for instance, whoever wishes to pray must learn the rulings of prayer; whoever possesses wealth must learn the rulings of zakat; both seller and buyer must learn the rulings governing sale and purchase; and anyone intending to perform the pilgrimage must learn the rulings of ḥajj. In such matters the duty is individual, whereas the remainder of the sciences remain a communal obligation.
Therefore, once a person embarks on the quest for knowledge he should not turn back; he must persevere unless something absolutely necessary prevents him—and that is another matter. Hypocrites, by contrast, are those who begin an action only to abandon it. At the Battle of Uḥud about 1,000 men set out with the Prophet ﷺ, and roughly one-third of them—hypocrites—turned back en route, saying, “If we had thought there would be fighting, we would have followed you” (Qur’an 3:167). Concerning them Allah the Exalted said, “On that day they were closer to disbelief than to faith” (Qur’an 3:167).