Medical procedures are inherently invasive and carry the risk of inducing pain to the mind and body. Recently, efforts have been made to alleviate the discomfort associated with invasive medical procedures through the use of virtual reality (VR) technology. VR has been demonstrated to be an effective treatment for pain associated with medical procedures, as well as for chronic pain conditions for which no effective treatment has been established. The precise mechanism by which the diversion from reality facilitated by VR contributes to the diminution of pain and anxiety has yet to be elucidated. However, the provision of positive images through VR-based visual stimulation may enhance the functionality of brain networks. The salience network is diminished, while the default mode network is enhanced. Additionally, the medial prefrontal cortex may establish a stronger connection with the default mode network, which could result in a reduction of pain and anxiety. Further research into the potential of VR technology to alleviate pain could lead to a reduction in the number of individuals who overdose on painkillers and contribute to positive change in the medical field.