The quarians created the geth sometime before 1895 CE to serve as a cheap labor and military force. Since they wanted the geth to be able to perform more complex tasks without supervision, they allowed each geth process to share data using an advanced neural network. As the quarians built more geth, this ability allowed them to become increasingly intelligent, rapidly approaching sapience.
According to Legion during a conversation with Commander Shepard and EDI in 2185 CE, in the year 2485 of the quarian calendar, Hala'Dama, a quarian overseer of geth workers, was asked by a geth whether it had a soul and what its purpose was. While not the first quarian to be asked such a question, she was the first to react with fear.
By repeatedly tweaking the geth's systems, the quarians had inadvertently allowed the geth to evolve into an Artificial Intelligence, thus becoming sentient. In response, the quarian government ordered an immediate termination of all geth programs. However, a number of quarians opposed such rash action, reasoning that their society needed the geth and that it was no crime for them to be questioning their existence.
Once the now-sentient geth realized what the quarians were doing, they retaliated. Initially only some geth began to take up arms in order to protect other units that could not defend themselves. The quarians placed their worlds under martial law, hunting down even those geth not participating in the hostilities, which was opposed by a large portion of the quarian people. They sheltered geth from the authorities, and were detained or killed as a result.
Eventually, the opposition became an outnumbered minority unable to prevent the outbreak of all-out war in 1895 CE. The geth emerged victorious within a year, overrunning the quarians' colonies and their homeworld of Rannoch. During the war, they committed a brutal genocide that eradicated all but a few million of the quarians- less than one percent of the pre-war population. The surviving quarians fled aboard their starships. Having lost their homes, the quarians pleaded for help from the Citadel Council, but were denied aid and stripped of their embassy as punishment for violating the Council's laws against creating artificial intelligences. All told, the Geth War resulted in the loss of billions of quarian lives, and inflicted irreparable damage to their economy and culture.
After the remaining quarians fled the planet, they remained on their ships and created a new government and society, known as the Migrant Fleet. The quarians' numbers were devastated: the geths' extermination campaign had left only a few million left, and they are still refused an embassy on the Citadel.
The geth made no attempt to pursue their former masters, though they could have easily finished them off as they retreated, out of uncertainty of the ramifications of annihilating an entire species-least of all their own creators. They chose isolation rather than face this uncertainty instead, and remained behind the Perseus Veil, away from the prying eyes of organics. Every attempt to open diplomatic channels with them failed: emissary vessels sent to open negotiations were attacked and destroyed the moment they entered geth space. In an attempt to protect the galaxy from the geth, the Citadel sent a fleet to the edge of the Veil. They suspected an imminent attack on all organics by the geth, but no attempt was made by the geth to leave their territory. Afterwards a treaty was established with the quarians by the Citadel to refrain from attacking the geth, lest they provoke retaliation. The geth adopted an isolationist policy, killing any organics that came near the Perseus Veil, and cutting themselves off from the galaxy for the next three centuries.
It is also implied by Legion that the geth feel a sort of remorse for killing so many quarians and display this by looking after the quarians' buildings, as though it were a cemetery. At the same time, the sacrifice of those quarians who had opposed martial law and the termination order were archived and honored by the geth, even if the quarians themselves had largely forgotten about them.