Spirit children of heavenly parents are born composed of spiritual matter. There is no such thing as immaterial matter.
Mormons should consult with the temple president to find out if a stillborn child can be sealed by proxy to its parents.
Mormons bless babies for two reasons: one is to create a record for the child in the Mormon Church, and the second is to give the child blessings and promises from God.
The Lord has not revealed when the spirit enters a body, but parents of lifeless children can be comforted through their faith in and knowledge of the merciful Lord omnipotent.
The Mormon Church makes membership records only for living members, but families are encouraged to record stillborn children in their own records.
No membership records are made in the Mormon Church for stillborn babies, so temple work cannot be done until the Millennium when those people are resurrected.
Personal experience seems to agree that newborns and toddlers may remember something of their pre-earth life.
Mormonism does not reveal at what point a fetus receives its spirit and becomes a separate organism. It may be different for each person.