Any living creature needs to feel pain to keep their body out of danger. It's a built-in requirement for continued life as a physical being. Without pain sensors and a consciousness to register it the body would be destroyed- such as what happens to people with leprosy. This sensation of pain is necessary for even the smallest of lifeforms, such as amoebas.
Although many lifeforms are seen as "unfeeling robots" by many scientists this is pure a projection by them. Any close examination of life will show that it is consciousness within the form that experiences and responds to outer stimuli. It is this consciousness that experiences pain when the body encounters a potentially dangerous situation, capable of physically damaging the life form.
These are two necessary things for the existence of physically focused life- a consciousness operating through the form and a form with sensitivity to its inner and outer environment. Part of this sensitivity is the ability to experience pain.