Official version
I took a look to the script (which you can find here)
Renton lies as before. Around the room are Swanney, Allison, Tommy,
Spud and Sick Boy. Allison begins screaming and wailing. Slowly, the
others rouse themselves to varying degrees.
RENTON (v.o)
I think Allison had been screaming all day, but it hadn't really
registered before. She might have been screaming for a week for
all I knew. It's been days since I've heard anyone speak, though
surely someone must have said something in all that time, surely
to fuck someone must have.
SICK BOY
What's wrong, Allison?
Allison points toward the bundle of dirty blankets in which her baby
is wrapped. Sick Boy follows her directions.
SPUD Calm down, calm down. It's going to be all right, everything's going to be just fine.
RENTON
(v.o)
Nothing could have been further from the truth. In point of fact,
nothing at all was going to be just fine. On the contrary,
everything was going to be bad. Bad? I mean worse than it already
was.
Sick Boy stands over the bundle. The baby is dead.
SICK BOY Oh, fuck. Sick Boy reaches out to Allison.
and looks like the death cause it's not specified.
Although, since Trainspotting is based on the novel of the same name by Irvine Welsh, I took a look to the synopsis of the novel (on Wiki here) and found that in the novel too the exact cause it's not specified, even if something about that is said:
Narrated by Renton. Lesley's baby, Dawn, has died. Though it appears
to be a cot death, it could also have been from neglect.
Opinion
Even watching the movie you can easily think to a vast spectrum of causes form which the baby might have died, but more probably it was for Sudden infant death syndrome (SIDS) which is actually cot death, or from undernourishment - as it is said by Renton they might have been under the effects of heroin for days:
She might have been screaming for a week for all I knew. It's been
days since I've heard anyone speak, though surely someone must have
said something in all that time, surely to fuck someone must have..