This was the showcase song at the end of the 1980 movie Fame, where it was performed by the students at the New York City High School for the Performing Arts. The song was written by Michael Gore, who was the musical supervisor on the film, and Dean Pitchford, who also helped Gore write the title song and the song "Red Light" for the movie. I Sing the Body Electric is the title of a 1855 poem by Walt Whitman, which is where Pitchford found the inspiration. In our 2012 interview, he explained: "I wrote the first verse in the course of a walk that I was making from my apartment to a friend's dinner party. I had been working and working on this idea of how we were going to finish the motion picture Fame and what was going to be written about, and I knew that we wanted to write something that would be there for an orchestra, but for a rock band as well, and for a gospel choir and soloists and that would involve dance - it had to be a lot of things to a lot of people in order to showcase all the abilities of these kids in the high school of performing arts. And on my way out the door I hit on this line from the Walt Whitman poem, I Sing the Body Electric, and on the walk, I wrote the whole first verse: 'I sing the body electric, I celebrate the me yet to come, I toast to my own reunion, when I become one with the sun and I'll look back on Venus, I'll look back on Mars, and I'll burn with the fire of ten million stars. And in time and in time we will all be stars.'
I got to my friend's apartment, and he opened the door and I said, 'Don't talk to me! I need a piece of paper!' I went into the bathroom and I put the lid down on the toilet and I sat down on the floor, and on the toilet paper, on the toilet lid, I wrote all of what I just said to you. That came that way." (Here's the full Dean Pitchford interview.)
Dean Pitchford was still working as an actor when he wrote the lyrics to this song, so he could relate very well to the kids who perform it in the movie. After working on Fame, he focused on writing and came up with the screenplay for Footloose, which had six hit songs on the soundtrack, all with lyrics by Pitchford.