Because there is an optimum placement position for the helmet on the head, having padding that helps keep the helmet in place, or makes the helmet more comfortable to wear, indirectly contributes to the safety of the helmet. But aside from a very minor absorption of force during the moment of impact the padding really has no direct impact on the safety a helmet.
Modern bike helmets are designed to deform in a crash. Basically, the hard foam and plastic that the helmet is made out of, crumples during an impact. This dissipates the force of impact during a crash. For this reason it is important to replace your helmet after any significant impact. The padding is mostly there for comfort, and to make the helmet fit slightly better.
From the Bicycle Helmet Safety Institute "The spongy foam pads inside a helmet are for comfort and fit, not for impact protection"