Puerto Rico was a colony of Spain until Spain ceded it to the US after the Spanish-American war. After a brief period of military rule, the Foraker Act was passed by Congress, which made substantially modified Puerto Rico's legal and political system, to harmonize it with that of the US. For example, "books and pamphlets printed in the English language shall be admitted into Porto Rico free of duty when imported from the United States", but there was a 10 year limit on duty-free import of Spanish publications (the law does not clarify whether that refers to "from Spain" vs. "in the Spanish language"). This also includes 48 USC 864 and an analogous provision in §35 that cases originating in Puerto Rico taken to the Supreme Court must also be in English. One may presume that at the time (as is true today), fluency in Spanish is not a requirement for SCOTUS justices. Other provisions were that the elected resident commissioner must read and write English. Because of the potential that any legal proceeding could end up in the Supreme Court, Congress may have found such an assimilationist policy to be practically motivated.
Incidentally, the law only requires that
"All pleadings and proceedings in the United States District Court for the District of Puerto Rico shall be conducted in the English language".