Pain is a very unpleasant necessity. It acts as a danger signal, to warn us that something is wrong with a part of the body. If we did not feel pain, very serious damage might be done without our being aware of it until it had got beyond curing.
Toothache, for example, draws attention to a tooth that has begun to decay. If the warning be heeded in time the tooth may be saved.