I've played most of the Halo games, but haven't read any of the novels, which is where you find most of the lore. Perhaps someone more knowledgeable on the topic can pick up these threads and put together a more comprehensive answer, but here's what I've been able to figure out:
The forerunners were extremely concerned with the threat of the Flood, and tried to figure out how to stop them. They created Flood research facilities in remote locations across the galaxy, in accordance with the Containment Protocol.
These facilities looked for weaknesses in the Flood, but found only one: starvation. They determined that if they destroyed all sentient life in the galaxy, then the flood would starve. They built the Halo rings to accomplish this.
The Librarian was outraged by this plan, resulting in the Conservation Measure:
When the possibility of the Halo Array was first proposed, the Librarian responded with outrage at the Builders' idea of defeating the Flood by committing galactic genocide, and petitioned Master Builder Faber and the Council to take measures to preserve the galaxy's life-forms in the event of the Halo Array's firing. ... As a result, the installations involved in the Halo Array, including the Halos themselves as well as the Arks which produced the rings—first the greater Ark and later Installation 00—were constructed to have surface conditions suitable for varying types of life, enabling the Lifeworkers to use them as biological preserves.
However, as the Forerunners became more desperate to find a solution other than galactic genocide, they began to experiment on the lifeforms that they were preserving on the rings, particularly humans. Since this is where the lifeforms were, I guess it made sense to build additional research facilities on the rings themselves:
Research on the Flood in an attempt to find a means to defeat the parasite was an integral aspect of the Conservation Measure. For safety, the Conservation Measure dictated that Flood research facilities be constructed in remote locations. Toward the end of the Flood conflict, the Master Builder began to alter his pact with the Librarian and authorized the use of the Lifeworkers' biological specimens on the Halos for extended experimentation on the Flood. Humans, in particular, were subjected to rigorous tests on Installation 07, due to the supposed immunity they appeared to exhibit to Flood infection.
So, it sounds like they built research facilities on the rings because it provided convenient access to the experimental specimens, and they were desperate and running out of time.