The Gulag was the penal system of the former Soviet Union. Prisoners were sent to labor camps and were forced to work without pay for long periods of time. Citizens could be sent to the Gulag for serious crimes, but also for petty infractions like missing work, showing up late for work, or stealing food from the fields for your starving family. Many prisoners were also there for political purposes. If you spoke out against the government, or if party officials saw you as a threat to their power, you could be sentenced to forced labor in the Gulag.
The Gulag was very effective at creating allegiance to the state and also for crushing dissent. The reason for its effectiveness in this end was because of the cruel conditions in the camps. The Gulag was located in isolated parts of Russia where it was very cold. The workers were tasked with difficult menial tasks and worked long hours with only simple tools. It was likely that you could die if you were sent to the camps as food rations were meager and conditions were very unsanitary. Violence upon the workers was common. For this reason, you dared not do anything to draw the suspicion of the Soviet party officials. Fear can be an effective tool for gaining loyalty and crushing dissent.
The economic benefits for the party are obvious: the use of free labor to draw profit. The Gulags performed many essential economic functions such as the mining of coal, deforested areas for lumber, mining copper, and sometimes large scale projects like the construction of canals. The cost of acquiring and maintaining this labor force was very low. For this reason, the Gulags provided an economic advantage for the Soviet Union.