The 15th Amendment protects voting rights of all American citizens. This, coupled with the 14th Amendment, guarantee that all former slaves were American citizens, guaranteed African-Americans the right to vote.
African-American suffrage had been a prime topic in Congressional circles as the Civil War wound down. The prime movers behind the passage of the 14th Amendment decided not to include the right to vote in the list of rights given equal protection. That Amendment was ratified on July 9, 1868; and just a few months later, Civil War victor Ulysses S. Grant was elected President, in a narrow victory made possible in part by votes from African-Americans in Southern states. (Indeed, New York, which had a large African-American population, went to Grant's opponent, Horatio Seymour, because African-Americans couldn't vote in New York.)
The Black Codes in most of the South had targeted former slaves. In the North as well, resistance to having African-Americans vote was strong in some states. Indeed, the Reconstruction Acts that Congress passed in order to convince Southern states to come into line with requirements for being fully admitted back into the Union provided for African-American suffrage in the South. But those Reconstriction Acts did not apply to the North, and so some Northern states, including most of the so-called "border states," did not allow African-Americans to vote.
Republicans in Congress, buoyed by Grant's election but seeing a need for more support from African-Americans, decided to press for suffrage for former slaves. Just before Grant's inauguration, in 1869, Congress proposed what became the 15th Amendment.
Three drafts made the rounds. One gave all male citizens age 21 or older the right to vote. One prevented states from holding back voting rights from anyone because of how well they could read, what kind of property they did or did not own, and where they were born. The third draft was what Congress approved:
Section 1. The right of citizens of the United States to vote shall not be denied or abridged by the United States or by any State on account of race, color, or previous condition of servitude.
The last part of Section 1, "previous condition of servitude," was a key phrase because the law of the land was still Dred Scott v. Sandford, which, even though slavery had been abolished, still ruled out citizenship for the descendants of slaves.
Nevada, on March 1, 1869, became the first state to ratify the Amendment. Other Northern and Midwestern states followed, with the vote in some Northern states not assured until late in the voting. As with the 14th Amendment, however, Congress had to withhold Congressional representation from Southern states until they ratified the 15th Amendment.
On March 30, 1870, the last needed state voted to ratify, making the 15th Amendment the law of the land.