When was this law passed, especially concerning federal elections, and what events led to this law's drafting? Was there any opposition to the passage of this law, and have there been any calls to repeal this law since?
The short answer is: because voting in the US is primarily a matter of state law, and all states other than Maine and Vermont have chosen to disenfranchise prisoners.
The original US constitution created only one popularly elected body: the House of Representatives. It was (and still is) elected as follows:
The House of Representatives shall be composed of Members chosen every second Year by the People of the several States, and the Electors in each State shall have the Qualifications requisite for Electors of the most numerous Branch of the State Legislature.
"[T]he Electors in each State shall have the Qualifications requisite for Electors of the most numerous Branch of the State Legislature" -- in other words, the people who had the right to vote in the state House of Representatives (or equivalent) would also have the right to vote for the federal representatives in that state. The federal government effectively outsourced the right to vote to the states.
Note that in the original constitution, the US senate was elected by state legislatures, and the US president was elected by an electoral college, whose members were chosen by a method to be determined by the state legislatures.
The first major change to this regime came in the wake of the Civil War. Congress was worried that the defeated southern states would deny freed slaves the right to vote. Their response was the Fourteenth Amendment, whose second section attempted to deter such behavior by reducing the representation of such states in Congress:
[W]hen the right to vote at any election for the choice of electors for President and Vice President of the United States, Representatives in Congress, the executive and judicial officers of a state, or the members of the legislature thereof, is denied to any of the male inhabitants of such state, being twenty-one years of age, and citizens of the United States, or in any way abridged, except for participation in rebellion, or other crime, the basis of representation therein shall be reduced in the proportion which the number of such male citizens shall bear to the whole number of male citizens twenty-one years of age in such state.
In short: if a state denied the vote to male citizens over 21 for any reason other than "participation in rebellion, or other crime", then its representation in the House would be proportionately reduced.
As it happens, this clause of the constitution was never enforced. Congress never established any mechanism or entrusted any official with the job of determining how many citizens had had their right to vote denied, and so there was effectively no way to enforce the provision. However, it did have one lasting effect: it legitimized the idea that states could deny the right to vote to criminals.
Later, the Fifteenth Amendment would prevent states from denying the right to vote on the ground of "race, color, or previous condition of servitude". This pattern would later be followed by the Nineteenth Amendment (forbidding states from denying the right to vote on the basis of sex), the Twenty-Fourth Amendment (forbidding states from denying the right to vote on the basis of nonpayment of poll taxes or other taxes) and the Twenty-Sixth Amendment (forbidding states from denying the right to vote on the basis of age, for citizens over 18).
You'll note that none of these amendments explicitly grant a right to vote: instead they say that states may not deny the right to vote on various grounds, leaving open the possibility that states may deny the right to vote on other grounds. The basic structure of the original constitution, which was that the federal government outsourced the rules of the franchise to the states, remained in place (although the states were now far more constrained in what they could do, especially in light of developments in Supreme Court interpretation of the Equal Protection Clause which by 1969 permitted state restrictions on voting only where they "served a compelling state interest").
The right of states to deny votes to criminals (including those who had completed their sentences) was confirmed by the Supreme Court in the case of Richardson v Ramirez. The court's reasoning relied heavily on the provision of the Fourteenth Amendment mentioned earlier.
I'd actually disagree with u/jesusvotes. This is an issue that centers around the conflict between the wording of Sections 1 and 2 of the 14th Amendment, which state:
Section 1
"All persons born or naturalized in the United States and subject to the jurisdiction thereof, are citizens of the United States and of the State wherein they reside. No State shall make or enforce any law which shall abridge the privileges or immunities of citizens of the United States; nor shall any State deprive any person of life, liberty, or property, without due process of law; nor deny to any person within its jurisdiction the equal protection of the laws.
Section 2
Representatives shall be apportioned among the several States according to their respective numbers, counting the whole number of persons in each State, excluding Indians not taxed. But when the right to vote at any election for the choice of electors for President and Vice President of the United States, Representatives in Congress, the Executive and Judicial officers of a State, or the members of the Legislature thereof, is denied to any of the male inhabitants of such State, being twenty-one years of age, and citizens of the United States, or in any way abridged, except for participation in rebellion, or other crime, the basis of representation therein shall be reduced in the proportion which the number of such male citizens shall bear to the whole number of male citizens twenty-one years of age in such State."
Emphasis mine. In 1974 the Supreme Court heard Richardson v. Ramirez, which argued that the disenfranchisement of felons violated the Equal Protection Clause (Section 1 of the 14th Amendment) of the Constitution.
The Court ultimately did not agree, seeing that the separate sections did not contradict each other, and section 2 specifically delineates that commission of a crime allows for disenfranchisement. Justice Rehnquist writing in the decision:
It is as much a part of the Amendment as any of the other sections, and how it became a part of the Amendment is less important than what it says and what it means.
He goes on to posit that while the Court had received many writings in favor of full restoration of rights (including voting) as part of a felon's road to rehabilitation, that it was the role of the legislative bodies to decide the merit of that argument. To roughly paraphrase Rehnquist's argument - It's constitutional to disenfranchise felons, let legislators sort it out.*
The dissenting opinion was written by Justice Marshall in which he argues interpreting Section 2 without context is to miss its function:
"There were two alternatives available - either to limit southern representation, which was unacceptable on a long-term basis, or to insure that southern Negroes, sympathetic to the Republican cause, would be enfranchised; but an explicit grant of suffrage to Negroes was thought politically unpalatable at the time. Section 2 of the Fourteenth Amendment was the resultant compromise. It put Southern States to a choice - enfranchise Negro voters or lose congressional representation."
As far as the passing of individual disenfranchisement laws, this does fall under the 10th Amendment and so each state has the ability to discern what constitutes a crime worthy of disenfranchisement. I'm not sure about all 50 states, I believe all are written into state constitutions. Instead of listing them out, here's a resource which lists out the process for voting restoration in each state with links to the laws or executive orders that spell out the process of voting right restoration - those should generally point to the initial amendment that establishes the disenfranchisement.
*The state of California did indeed take the suggestion of Justice Rehnquist and six months after the decision passed a law amending their state constitution to limit felony disenfranchisement to time served (prison term + parole).
Source:
https://www.law.cornell.edu/constitution/amendmentxiv
http://caselaw.findlaw.com/us-supreme-court/418/24.html
http://felonvoting.procon.org/view.resource.php?resourceID=000286