Q. Does extreme pain such as a severe tooth cavity qualify as pikuach nefesh or danger of life to violate Shabbat and drive to a dental clinic?
A. Shulchan Aruch (O.H. 328: 2) rules that situations that are clearly pikuach nefesh or life-threatening, such as one who is dying of a disease and will die without medical intervention, one has to desecrate Shabbos without delay and save that life.
In the case of a severe tooth cavity with extreme pain, Shulchan Aruch (328: 3) and Mishna Berura (ibid. 8), consider this to be tantamount to an inside body wound and constitutes pikuach nefesh, Shevet Halevy (1: 70) permits also in the case of a severe dental infection, while Tzitz Eliezer (8: 15) permits only in extreme pain.
Horav Shlomo Miller’s Shlit’a opinion is similar, however the Rov pointed out that sometimes an aggressive food particle or similar may be the cause of the great discomfort, and it could be promptly removed without any chilul Shabbos. The Rov also pointed out that severe and extreme physical pain may even on external wounds constitute pikuach nefesh, as it may reflect great malady and infection that can place in jeopardy the life of the victim.
In such cases the Rov asserts one is to be machmir and exercise stringency in maintaining a life, that will then keep many more days of Shabbos.
Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit’a