TV presenter and cook book author Teigen was widely praised for sharing the news on social media late last month, describing her devastation at the loss.
Families who had experienced similar heartbreak thanked her for raising awareness.
Legend dedicated his Billboard Music Awards performance on Wednesday to Teigen and has now shared a lengthy tribute to her on Instagram.
He said: “I wrote this song because I have faith that as long as we walk this earth, we will hold each other’s hands through every tear, through every up and down, through every test.
“We promised each other this on our wedding day seven years ago, and every challenge we’ve faced has made that promise more powerful, more resilient. Our love will remain. We will never break.”
Legend, 41, and Teigen, 34, married in 2013 and are also parents to four-year-old daughter Luna and two-year-old son Miles.
The baby they lost was a son named Jack. In his Instagram post, Legend thanked fans for their support and said messages from families who had suffered similar heartbreak had been a source of comfort.
He said: “Thank you to everyone who has been sending us prayers and well wishes, flowers, cards, words of comfort and empathy. We feel and appreciate your love and support more than you know.
“More than anything, we’ve heard so many stories about how so many other families have experienced this pain, often suffering in silence. It’s a club no one wants to be a part of, but it’s comforting to know we’re not alone.”
Legend, an Oscar, Tony, Emmy and Grammy winning singer, said Teigen “will have much more to say about this when she’s ready”.
He added: “But just know we’re grateful and we’re sending love to all of you and your families.”