
In an odd twist that – I suspect – will not make any difference, given Congress’s usual disinterest in having any laws actually apply to themselves, it turns out that at least some of the Capitol fence is, in fact, against the law. Not, sadly, the fence itself, but the barbed wire that was put up on top of the fence. We have to go back over 120 years to get the whole story.
On January 8, 1898, Representative David Henry Mercer, Republican from Nebraska, introduced a bill to the House. Given the number 6083 of the 55th Congress, it was entitled “A bill To regulate the construction of barbed-wire fences in the District of Columbia, and for other purposes.”
What Mercer had against barbed-wire fences in general, and those in the District in particular, is one of those things we will probably never know. In fact, his biography indicates only that he was chairman of the Committee on Public Buildings and Grounds in three of the five Congresses he served in. He seems to have taken this aspect of his job quite seriously: The local Board of Trade offered a resolution “regretting the defeat” of the Representative after his loss in 1902. Otherwise, his legislative record seems to have been quite thin.
In any case, the bill he offered up in January 1898 slowly made its way through Congress, being passed in March by the House committee on the District of Columbia, followed by the Senate committee the next month. Unfortunately, the bill seems to have been entirely uncontroversial, so no debates were held in either House or Senate, so there no arguments about why this bill was so important were ever promulgated. In fact, the only time barbed wire was ever mentioned in D.C. prior to the law was as a way of keeping people from falling off of roof-top decks.

It would take until the very end of the legislative session to pass. On July 7h, the Senate passed the bill, now given the number S 9204, and, later that day, so did the House. It was signed by President McKinley the following day.
So, even today, if you look at the laws of the District of Columbia, they are quite clear:
That no fence, barrier, or obstruction consisting or made, in whole or in part, of what is commonly called barbed wire shall be erected, constructed, or maintained along the line of or in or upon any street, avenue, alley, road, or other public walk, driveway, or public or private parking within the fire limits of the District of Columbia.
The ‘fire district’ was a recent creation, and consisted of the original city of Washington plus the southern parts of Georgetown. This area was considered particularly fire-prone, and so greater strictures were placed on what could be built there.
However, it was not the only place where the law was to be enforced: Outside of it, there was a general ban on barbed wire, though here a permit from the district commissioners would allow it under special circumstances.
What is quite clear is that the strings of barbed wire topping the Capitol fence are not allowed according to the laws written by Congress 120 years ago. Whether the current Congress will feel constrained by their forerunners is an entirely different question.
Thanks to @jekubi for finding the text of the law, @EABoylan for asking about it, and @PenguinSix who originally mentioned it.