It is a rabbinic mitzvah (mitzvah mi’drabbanan) to pray in a minyan. The Chachamim obligate a person to make an effort to walk to a minyan, even if it is far from his house, approximately the walking distance of a mil (960 meters or approximately .597 miles), which takes about 18 minutes (Mishnah Berurah 90:52). If he is traveling, and within 72 minutes (approximately the time required to walk four mils) will arrive at a place that has a minyan, even if he planned to stop to rest, he must continue traveling in order to pray in a minyan. However, if the minyan is not on his way, he must only go out of his way up to a walking distance of 18 minutes in order to pray in a minyan (Shulchan Aruch 90:16)
According to many poskim, whoever normally travels by car must, in order to pray, drive to a minyan as far as 18-minutes away. Similarly, someone who is traveling by car and knows that within 72 minutes he will arrive at a place that has a minyan, must continue onward to that minyan (see the note).
A person, who must urgently secure his business or property or otherwise suffer monetary loss, is permitted to pray individually in order to prevent personal loss. However, businessmen and craftsmen must stop working in order to pray in a minyan, despite the fact that while they go to pray in a minyan they cannot continue to work and make money. Only if a mishap occurs, which if they do not handle, will cause them to lose a great deal of money, in that particular instance, they are permitted to pray individually (Mishnah Berurah 90:29).
A person who needs to travel in order to attend to urgent matters or for medical care and by praying in a minyan will not arrive at his desired destination on time, is permitted to pray individually, since otherwise he will suffer a loss.
. The question is whether the obligation of a mil is measured by time or distance, and from this we can derive whether or not there is an obligation to travel up to 18 minutes by car to a minyan. The Bei’ur Halachah 163:1, s.v. “B’richuk,” writes regarding attaining water for washing one’s hands (before eating bread) within the walking distance of four mils before him, that we measure by time and not by distance. That is also what is written in the Mishnah Berurah 249:1 concerning traveling on Erev Shabbat. By contrast, the Mishnah Berurah 92:17, on the subject of washing one’s hands before prayer, and 110:30, about tefillat haderech (the traveler’s prayer), writes that it is measured according to distance and that is also what is written in Pitchei Teshuvah, Yoreh De’ah 112:6. Tefillah K’Hilchatah 8:12 and Avnei Yashfeh 6:5-6 maintain that this obligation refers to time and whoever has a car must travel up to 18 minutes. In practice, one who is traveling on his way is obligated to continue up to 72 minutes, which is similar to what is written in Bei’ur Halachah 163:1. However, if he is in his house, there is disagreement as to whether or not he is obligated to travel 18 minutes by car. It is best to be stringent, though those who act according to the lenient opinion have on whom to rely. Nonetheless, all of these laws pertain only to a temporary situation, but in a permanent one, every Jew must set up his home no more than a distance of an 18-minute walk from a synagogue. If he has no choice and is compelled to live farther away, it is proper for him to accept upon himself to walk or drive farther in order to pray in a minyan.
Kaf HaChaim 90:107 writes according to Binyan Olam that within a city, a person must walk more than a mil, and the measure of a mil is specified only when one needs to walk outside the city, as in the laws of techumei Shabbat (Shabbat boundaries). However, the Chayei Adam, Mishnah Berurah 90:52, Aruch HaShulchan 90:20, and many others maintain that even in the city one must walk no more than a mil. Since the mitzvah of a minyan is rabbinic, the halachah goes according to those who are lenient. This refers to walking, but regarding driving there is more room to be stringent, since anyway there are poskim who are stringent about driving and obligate going to a minyan according to time and not distance.
. The Magen Avraham 671:12 writes that when a person is preoccupied with thoughts of his business, he is exempt from going to pray in a minyan. This implies that if an opportunity arises to gain a large sum of money, far beyond what he usually earns, he is permitted to go according to those who are lenient and pray individually. However, even for a great profit he may not conduct business before he recites Shacharit. See Mishnah Berurah 90:29.