This is not new, but recent research helps us understand why it works. The abstract says “The primary musical features of infant-directed singing are ideal for emotional coordination and sharing between parent and infant without the risk of over-stimulation.”
What this means is that singing between a parent and baby is a shared activity that forms a bond. That bond conveys many different benefits including a sense of safety and security and an ability to identify our carers and family (remembering a baby can not see well at birth so they are relying on the auditory processing networks to figure out their new world outside the womb). Singing also does this without overstimulating the baby, which is an important consideration, both of a typical developing baby and a baby that may have had a rockier entry to the outside world.
Pain accentuates all of these issues – it gets in the way of bonding and emotional coordination and makes the line where overstimulation occurs far closer. Singing mediated all of those issues while also assisting parents to de-stress. Singing could be prescribed as medicine, and as the abstract suggests, medicine is needed day and night. Singing to babies has a combination of biological and psychological benefits for both bub and stressed parents.