The Edo Tensei technique uses a living person as a vessel to reincarnate dead people. You can imagine Orochimaru and Kabuto using this technique with no problem since they are evil, but what about its creator Tobirama Senju? Isn't he supposed to be a good guy? How could he create a technique which requires a living sacrifice?
Tobirama Senju was not a good guy. In the anime and manga, the Second Hokage was very much presented as a Danzo-like figure, in contrast to his brother Hashirama would be considered a good guy. Tobirama, like Danzo, operated in a more moral gray zone, doing whatever he thought necessary to protect the village. Even his wiki page calls him pragmatic and points out:
... when Hashirama would get carried away with his headstrong optimism, it fell to Tobirama to mediate and force a more realistic alternative in order to achieve those idealistic goals. Hashirama was typically disappointed by Tobirama's intervention, but he usually agreed without much protest. But Hashirama would, at times, push back against Tobirama, often because Tobirama's methods were becoming too forceful; Hashirama's rare displays of anger on such occasions were enough to make Tobirama back down.
He may not have been as extreme as Danzo; I don't think whether he was or not is made clear by the anime. But the impression I got while watching was that he was like Danzo, and not idealistic, so he would surely see the usefulness of the Edo Tensei jutsu and want to use it to protect the village.
To back up my answer, I've collected some evidence (all quotes come from English subtitles on Japanese dub on Crunchyroll). First, that Tobirama was like Danzo:
From the episode The All-Knowing, a conversation between the reanimated Tobirama and Orochimaru (also some info on Tobirama's opinion on Edo Tensei jutsu):
Tobirama: "I can't believe the jutsu I devised would be used so casually."
Orochimaru: "It's not a complex jutsu. However, you should not have created it in the first place ... Many of your policies and jutsu that you developed ended up causing problems later on down the line."
Orochimaru points out that many of Tobirama's policies were bad. He probably had good intentions, like Danzo, but he valued the village and stability above all else, and ended up causing problems as a result.
In the same episode, after Tobirama scoffs at the Uchiha's rebellion and says he foresaw such a thing happening, Orochimaru points out a specific policy that caused problems: appointing the Uchiha to the police force.
"But you're the one who drove the Uchiha to it, Lord Second. It could be said that the seeds got sown with the Uchiha Police Force you created. Those who crack down on crime tend to be easily disliked."
Tobirama defends his actions, saying the Uchiha were eminently qualified for their position, but even his brother Hashirama scolds him, saying he told him time and time again not to slight the Uchiha.
Furthermore, in the episode Sasuke's Answer, the Third Hokage makes the Danzo-Tobirama connection implicitly:
"I wasn't able to to continue the Second Hokage's task of village-building skillfully enough. Which is how I ended up burdening Danzo with the village's darkness."
This quote indicates that the Second Hokage did take on the role Danzo had after him, of dealing with the dark aspects of the village, the things that needed to be done to ensure stability. The Third Hokage's remark comes after Tobirama explains his thoughts on the Uchiha, and his policies on the village, to Saskue, after Sasuke asks, "I thought you hated the Uchiha."
"That's not entirely true. I treated anyone who posed a danger to the village ... with extreme caution. And there's no doubt the Uchiha warranted my suspicion ... The idealism of my elder brother, and the danger of Uchiha Madara; mediating between these two things, and strengthening and protecting the village were my duties as the Second Hokage."
I also said Tobirama was not a good guy. I believe this is true. Everything you read about him will tell you he's pragmatic, and doesn't rush to judgement, and even will accept Uchiha (but only if they put the village above clan). This is also true. However, his implicit bias against the Uchiha is obvious in many of his comments. He may think of himself as mostly pragmatic, and he may think himself fair towards the Uchiha, but he is clearly not. Unlike his brother, he is not an idealist. He was born in a time when Uchiha and Senju fought and killed each other, and hated each other, and as a result he hates the Uchiha. Some of his comments on Uchiha:
"They're unpredictable." (from My True Dream)
"You're from the Uchiha. Of course you'd stick with a scoundrel." (from The All-Knowing)
The fact that Tobirama drops comments like these is proof of his implicit bias. He claims to be merely cautious, and that's warranted, but he clearly views the Uchiha with disdain, fear, and anger.
Also, notably, Tobirama killed Madara's younger brother Izuna, and the two of them display transparent suspicious, if not outright animosity towards each other.
In the episode My True Dream, Tobirama and Madara exchange glares, but say nothing. Again, transparent suspicion, if not outright animosity. They both have telling conversations with Hashirama in this episode (emphasis mine):
Tobirama: "To propose Madara as a candidate for leader is fine... But the final decision will be made with the top officials. ... Things are different from father's era. ... Besides, Madara Uchiha being chosen as the leader won't happen. Everyone knows ... You are the one who founded this settlement. Even those from the Uchiha say as much. Furthermore, haven't you heard the rumors about them? The stronger the hate, the stronger their Visual Prowess manifests itself ... They're unpredictable. ..."
Hashirama: "Stop talking like that, Tobirama!"
Tobirama: "From now on, things will be run democratically. Any objections?"
Hashirama: "No... That's fine."
Though he seems pragmatic for most of this conversation, Tobirama let's this obvious hateful comment about the Uchiha slip, and his brother Hashirama has to yell at him for it. It's also obvious he distrusts Madara.
Now, Madara and Hashirama:
"After you, I suspect Tobirama will become the Second Hokage. When he does, the Uchiha will eventually be eliminated."
Madara is suspicious of Tobirama, and suspects his clan will be wiped out because of him. I don't think his suspicions are unfounded, because the Uchiha do end up getting wiped out because of Tobirama's policies and legacy. In other words, Madara had good reason to be suspicious of Tobirama, and this remark should be seen as part of the characterization of Tobirama as not being a good guy. Madara is biased, and he probably helped escalate the conflict, but Tobirama has clear animosity for the Uchiha, and his pragmatism did not overcome that.
Make no mistake: Tobirama made the Uchiha into the police force to keep them in the village, under his watch and under his thumb. He did this to maintain stability, but it was inevitable that it lead to tension. Unless he wanted the Uchiha eliminated entirely, it was a short-sighted decision, as it led to the necessity of dealing with an Uchiha revolt during the Third Hokage's time; to which the village elders decided to use Itachi to kill the entire clan.
Tobirama is a complex character; he's pragmatic, but weighed down by implicit biases (which he probably would deny having, as he's likely unaware of them). His distrust of the Uchiha is also warranted, as he says, because they are dangerous, but his distrust also stems from his hatred of them for killing his clansmen. He is a complex character, neither purely good or evil, but motivated by concrete goals, and I think he's the better for it. Far more interesting than Hashirama.
Getting back to the original question of how Tobirama could be the one to create the Edo Tensei jutsu, it should be obvious now; he is pragmatic and saw the usefulness of such a jutsu in terms of military power. He did eventually declare it a forbidden jutsu, so he did also realize the danger in it. As Orochimaru said, creating this jutsu is just one of the bad decisions he made (ostensibly for the good of the village) that had terrible consequences down the line. And note, if you're getting lectured by Orochimaru, you know you've got to have taken some pretty consequentially bad actions.
What Fumikage Tokoyami said in the comments is pretty spot on.
While yes, Tobirama was a good guy, that doesn't mean all of his ideas are perfect. Tobirama created the Edo Tensei justu with a purpose that was good in theory
One of the major benefits of the Impure World Reincarnation is that it grants immortal bodies to those who are reincarnated. Any damage they receive will regenerate in time and, assuming the damage is not too debilitating, they can continue attacking even before their body recovers. This was one of the main purposes Tobirama created the technique for, as he would use one or more reincarnated souls to perform a series of Kamikaze-like attacks until the opposition was wiped out
Naruto chapter 561, emphasis my own
However, due to its flawed nature (ie requiring a live sacrifice and other general flaws in the original design), Tobirama marked it as a kinjutsu and banned its usage. Orochimaru, and then Kabuto, discovered, expanded, and perfected the usage of this justu for their own evil intention.
The above can be all considered for other kinjutsu as well, such as Chiyo's One's Own Life Reincarnation. It was a jutsu that was created with intentions that were not necessarily evil, but forbidden due to its nature.