The earliest instances of railroad as a verb have the literal sense "traveled by railroad" or "constructed railroads"—neither of which meanings is particularly relevant to the OP's question.
Dictionary definitions of the slang verb 'railroad'
According to one early dictionary of slang, the first slang sense of railroad as a verb was simply "to rush"—making "to railroad" sound akin to what we might today call "to fast-track." J.S. Farmer & W.E. Henley, Slang & Its Analogues, volume 5 (1902), states flatly that the term originated in the United States, and provides two examples from 1889:
RAILROAD, ... Verb. (American).—To run a matter with all speed ; TO RUSH (q.v.).
1889. Sci[entific] Am[erican] N.S., lvii. 37. The Alien Act that was RAILROADED through at the close of the last session.
1889. Pop[ular] Sci[ence] Monthly, xxxii. 758. A New York daily some time ago reported that a common thief ... was RAILROADED through court in a few days.
The interesting thing here is that the second example uses railroaded in its narrower sense of "incarcerated without due process of law," the sense that seems most prominent today, and yet Farmer & Henley doesn't draw the conclusion that this specific sense of the word constitutes a stand-alone meaning. Neither does Farmer & Henley observe that the rushing associated with its other quotation from 1889 is about hastily forcing enactment of legislation without giving legislators time to study the provisions of the proposed law carefully. As we shall see, this more specific sense of the term has a long history of U.S. slang use.
Much later, Harold Wentworth & Stuart Flexner, Dictionary of American Slang, first edition (1960) identifies three slang meanings of the verb railroad but says that the earliest meaning was the specific one involving unjust imprisonment:
railroad v.t. To send a person to prison without proof of guilt, due process of law, or a fair trial; to send to jail by false evidence or by cheating, tricking, deceiving, or framing. 1877: [Craigie & Hulbert,] D[ictionary of] A[merican] E[nglish on Historical Principles (1938–1944)]. [Example from 1930 omitted.] 2. To force or speed up an action without due process, in disregard of regular or accepted procedures, or without the consent of others concerned; to force one's opinion or schemes upon others. [Example from 1934 omitted.] 3. To hurry, in the preparation of food. [Example omitted.]
'Railroaded' as 'enacted or performed with undue haste'
One early match for railroaded in the sense of "enacted with undue haste" appears in the Somerset [Pennsylvania] Herald (February 12, 1873):
The bill for the benefit of the Pennsylvania Railroad Company, that was railroaded through both houses of the Legislature with such indecent haste last week is said to have underlying it a proposition to place four tracks on that thoroughfare from Pittsburgh to Philadelphia, a commendable and perhaps necessary work, but scarcely requiring such hot Legislative haste.
The same newspaper uses the term again in an article dated March 19, 1873:
All reports from Harrisburg agree in the allegation that the general appropriation bill was railroaded through the House, on Thursday last, with most indecorous speed.
Similarly, from "The Legislature Yesterday," in the New Orleans Republican (February 21, 1874):
Mr. Murrell, of Madison, said he was glad to see his opposition to monopoly had done some good. It had produced a change in the mind of the member from the seventh ward. But he was opposed to railroading bills through, and desired a chance to scrutinize them. If it was a genuine reform measure, although it might be introduced for revenge, he would vote for it, and pray that other members might be moved by the same motive in the same way.
...
Mr. Mayo, of Rapides, desired to reconsider the vote by which Seventh Judicial District had been re-districted. It was seldom that he troubled the House by rising from his seat, but yesterday this bill had been railroaded through with sufficient rapidity to have carried it to the moon if it had taken that direction, and he knew nothing about it.
Also, from "The Postal Change," in the [Washington, D.C.] Evening Star (March 11, 1875), in an article a very late amendment to a bill that doubled postage rates for thrid-class mail:
The lobby technically calls this kind of legislation 'railroading a bill.' Perhaps it would not be parliamentary to call it 'swindling,' but its title to the term is somewhat valid in view of its deliberate deception of members of Congress, and of its extorting thousands from the pockets of the people under the color of legal fraud. ... It is hoped that none of hte other bills 'railroaded' through Congress contain similar onerous and unjustifiable legislation, though several of the appropriation bills were put through in a promiscuous way in the last hours of the session, without proper knowledge, of course, of many of their provisions, having been delayed by the occupation of time with merest party and mischief-making legislation.
An example of railroaded in what appears to be the nonpejorative sense of "expedited" appears in an item in the Springfield [Indiana] Republican, reprinted in "What the Papers Say" the Bossier [Louisiana] Banner (July 6, 1876):
The twelfth and last of the regular appropriations bills (the Sundry Civil) is only about half the usual bulk, retrenches to the tune of $14,000, and is to be railroaded through the House at the very highest attainable rate of speed. The Democrats can certainly afford to go to the country upon this retrenchment issue if the Republicans can.
But the more pejorative sense of "rushed throughout without proper consideration", reappears in the New Orleans Daily Democrat (March 2, 1877):
The passages in the memorial denounced by Mr. Steven are those intimating that Mr. Guthrie had been refused a hearing before Mr. Texada's Committee on Drainage; that the drainage bill had been "railroaded" through and that the report of the committee, Mr. Texada's, would have been different from what it was but for personal interests.
The same newspaper uses railroaded in a similar sense in items on January 28, 1878 (two separate letters to the editor)and
March 24, 1878.
And likewise from "The Legislature," in the [Jackson, Mississippi] Daily Clarion (February 24, 1878):
Take the revenue bill, for example, the most important measure of the session; it has not been reported. It will be taken up section by section in both houses, carefully examined and discussed; and it is not reasonable to suppose that it can be adopted short of several days' hard work. A bill of that importance should not be railroaded through the legislature with the speed of a lightning express. And so with other measures which will readily occur to the minds of the members.
'Railroaded' as 'committed to jail or prison without administrative delay'
As early as 1869, newspaper articles use the term railroaded to mean something like "sent by railroad to prison with little or no delay." From "The Police at Length Capture a Gang of Burglars and Get the Property," in the [New York] Sun (February 23, 1869):
The thieves, eight in number, were thrown into consternation when the officers thus suddenly appeared in their midst, and made no attempt to escape. Some of them coolly "guessed that they were going to be railroaded." Mr. Berman has identified his property.
An early instance where railroaded refers to being shipped swiftly to prison, but lacks the pejorative sense of a miscarriage of justice appears in "The Flag Insulted," from the New York World of March 6, 1877, reprinted in the Greenville [Mississippi] Times (March 17, 1877):
To emphasize its indignation at the counting in and inauguration of [Rutherford] Hays and [William] Wheeler, The [New York] Sun yesterday, as is elsewhere recorded, displayed the American flag union down at half-mast on its building. ... One of these [supporters of Hayes] was particularly noisy about 5 o'clock, swearing, with clenched fists that Mr. [Charles] Dana ought to get a coat of tar and feathers and then be "railroaded" to Sing Sing for ten years.
This last recommendation sounds very similar to the brutal mob punishment of being tarred and feathered and "ridden on a rail" that Twain describes in Huckleberry Finn; for a brief discussion of the extremely unpleasant details of this punishment, see note 27 of The Annotated Huckleberry Finn, which observes that Twain's older brother Orion Clemens had suggested such a punishment in a dispute that occurred in 1853. Whether the older "ridden on a rail" is echoed (or reconstituted) in the 1870s slang term "railroaded" is a matter of conjecture; but I think the connection is unlikely.
A similar usage appears in "Our New York Letter," from the New York Observer (October 5, 1877), reprinted in the Fayetteville [Tennessee] Observer (October 18, 1877):
The question in everybody's mouth now is is "Who among us can be relied on!" and no one appears inclined to venture a reply. Were I called upon to answer the conundrum I should say that until laws were passed, and enforced too, under which great and awe-inspiring criminals could be railroaded from their luxurious offices into the with the fewest possible stops along the route, the community has no reason to expect anything different and is served just right for its failure to protect itself.
And in "How the Northern Press Regard the Decision of Our [State] Supreme Court," in the [St. Francisville, Louisiana] Feliciana Sentinel (March 30, 1878):
(Chicago Times.) Anderson is at liberty, and Wells and the colored brethren of the Returning Board will not be 'railroaded' into the penitentiary at present. The Supreme Court of Louisiana has decided that the alteration of figures in election returns is not an act of forgery, and consequently that the indictments for doctoring the Vernon parish returns could not stand. The decision is comforting to the returning Board, but as it removes every vestige of restraint upon election frauds, it will not be healthy for the party which does not handle the returns hereafter. It might have been better for the interests of honesty and justice if the Governor had pardoned Anderson and amnested his partners in the conspiracy, and thus relieved the court of the duty of deciding that election returns may be falsified with impunity.
And in the Catoctin [Maryland] Clarion (August 1, 1878):
At an early hour Wednesday morn- a seargeant and two special officers, arrested three men for attempting to commit house robbery at Franklin and Brown streets, Philadelphia. The thieves made a desperate resistance, firing five shots at the officers, one of which took effect in the foot of Seargeant Smith. They were howver taken in tow, and will in all probability be "railroaded."
'Railroaded' in the sense of 'denied a fair trial before being convicted'
On the other hand, "railroaded in this sense of "sent to prison unjustly" seems to be the sense of the term in this excerpt from "The Fisk Murder Trial," in the [New York] Sun (July 9, 1872):
Q.—How often, as near as you can get at it, have you heard threats by him [Col. James Fisk] against the life of [Edward] Stokes?
A.—On a number of occasions, when Fisk was at Mrs. Mansfield's house.
Q.—Were you present at any time when anything was said with reference to having Stokes railroaded to State prison?
A.—Yes, sir, I was; in the front parlor of Mrs. Mansfield's house. That was the year before the killing.
And from testimony by city marshal Hiram Ferguson, in "John Scannell's Prayer," the [New York] Sun (February 22, 1873):
Two or three days before his processes were stopped Scannell came to live in my house, because, he said he heard that a warrant was out for him. He told me that he did not intend to be arrested at that time. That Donohue was in the Tammany Hall Ring and would have him railroaded and he would not have an opportunity of proving his innocence.
Also from"More Haste Than Speed," in the [Centre Hall, Pennsylvania] Centre Reporter (March 8, 1877):
When Joe Coburn protested against "being railroaded into State prison," the general impulse of the community was to give the man fair play. Governor Hayes is certainly entitled to at least as much consideration as Joe Coburn, and should not "be railroaded into the White House." ... The general principle of the validity of fraud laid down by the commission in all the judgments which it has thus far rendered, is so essentially immoral that sensible men see it to be dangerous to society; and the decisions have been marked by such slovenly haste in the work of "railroading Hayes into the White House" that the details are full of inconsistencies.
Here, of course, the author is playing on the two slang senses of railroaded: denied a fair trial, and rushed through without due diligence.
And from "The California Tweed," in the [Canton, Ohio] Stark County Democrat (May 17, 1877):
The return of Pinney, the defaulting naval pay clerk at San Francisco, is raising as big a rumpus among radical politicians on the Pacific slope as did the threatened confession of Tweed in New York. There are a couple of millions involved. Pinney was kept out of the country by threats of his "pals," that he should be railroaded to the Penitentiary should he return, and is back now, mad at being cheated and betrayed by his associates.
And from "An Unfortunate Woman," in the [Canton Mississippi] American Citizen (March 2, 1878):
A case has just been decided in New York that illustrates afresh the ease with which a sane person may be put permanently out of the way in an insane asylum. Miss Susan Dickie was sent to the Bloomingdale Asylum in 1871, for no other reason apparently than because she was a rather disagreeable young person to have around, an there she might have stayed indefinitely but for a lucky accident. In order to settle her father's estate, it became necessary for the imprisoned daughter to be legally represented by somebody, and so formal proceedings were begun to have her declared judicially a lunatic. But unexpectedly the lunacy commissioners were not content to hear only one side of the case, and, upon having Susan's case presented, it appeared that she was a sane woman, who was simply "railroaded" into an asylum by her loving brothers and sisters, upon the certificates of doctors who hardly did more than glance at her, because they didn't like to have her around.
And finally, from "Captain Kidd," in the Juniata [Pennsylvania] Sentinel and Republican (March 19, 1880):
Kidd was denied counsel, was hampered by legal tricks, and brow-beaten and over-powered by the six partial judges on the bench and the five cunning lawyers opposed to him. His trial was "railroaded." It began May 8, two verdicts, one for "murder" and the other "piracy," were brought in on the 9th and on the 12th, three days following, Kidd was hanged in execution dock.
Conclusions
The slang term railroad in the senses of (1) "enact legislation without due deliberation," (2) "send off to prison without unnecessary delay," and (3) "convict without giving a fair trial" appears to be a thoroughly American invention.
Instances uncovered in the Library of Congress's "Chronicling America" database of historical newspapers push the earliest established date for each of the three senses of the term to February 23, 1869, for railroaded in the sense of "committed to jail or prison without administrative delay"; July 9, 1872, for railroaded in the sense of "denied a fair trial before being convicted"; and February 12, 1873, for railroaded in the sense of "enacted or performed with undue haste."
The extent to which the emergence of one of these meanings influenced the emergence of the others is unclear, given how close together the first instances appear to be. Pennsylvania and Louisiana are locuses of early usage of the legislative sense of railroaded, while New York City claims the earliest instances of both the quickly incarcerated and the unfairly convicted senses of the word.