Firefly was cancelled before it ever was able to expand on the back stories of most of the characters, and the follow-up movie, Serenity, simply didn't have the time. Did Joss Whedon ever reveal the history to Shepherd Book?
His background is explored further in the comic book Serenity: The Shepherd's Tale. Book was born Henry Evans, a boy who was raised by an abusive father. He ran away from home and began life as a petty criminal before being recruited by the Independence movement and moving out to the Border Worlds. Long before the Alliance begins the Unification War, forward-thinking Browncoats assign Evans to be a long-term mole. He sheds his old identity by killing a random passerby and stealing his identification card, becoming Derrial Book. His Browncoat superiors keep tabs on him by surgically removing one of his eyes and replacing it with a camera. He joins the Alliance military and quickly moves up in rank. Becoming an officer, Book intentionally leads a risky operation that results in a humiliating defeat for the Alliance. He is forced to retire from the Alliance military. It is implied that the Alliance covers up the loss, therefore not officially punishing Book. Homeless, he visits a soup kitchen and finds God while contemplating a bowl of soup. He takes refuge at an abbey where he becomes a shepherd before leaving on Serenity to become a missionary.
More on the comic can be found on the Firefly Wikia.