The Autobot plague victims are victims of the ancient Cybonic plague, a disease that was created during the Great War by Megatron himself. It's primary use was to infect the Autobots and wipe them all out. The only cure that could be found was with Megatron, who created the disease.
When Optimus Prime and Ratchet were investigating an Autobot distress signal, they found and entered a centuries-old crashed ship in hopes of finding any survivors inside. Instead they saw the deceased bodies of the ship's crew. After scanning a disease-ridden body, Ratchet concluded that they didn't die in the crash, but from an ancient virus known as the Cybonic Plague. When the ship moved, one of the victims' bodies, which hung from the ceiling, dripped infected Energon. One of the drops fell on Optimus' optic, causing him to be infected.
After that, they were left behind for medical cautionary measures.