Sofia gets sentenced to twelve years in jail for sassing—talking rudely—to the mayor's wife and for hitting the mayor. As Celie puts it in a letter to Nettie,
Polices lock her up for sassing the mayor's wife and hitting the mayor back.
Sofia, Celie goes on to say, was "dying" working in the prison laundry, so the family managed to get her jailed instead in the mayor's house. After serving eleven and half years, Sofia was paroled for good behavior so that she could be with her family:
Anyhow, they kept her eleven and a half years, give her six months off for good behavior so she could come home early to her family.
The episode is an indictment of the way the justice system treats Black people. Sofia served a long sentence for very minor crimes, and being released six months early was no great act of charity. As Celie notes, by the time Sofia got back home, her older children had grown up and left, and the younger children did not remember her.
Sofia notes that she is on parole and has to behave herself. When she first comes home and is eating dinner with the family the first night, the children act as if she isn't there.
Celie, who uses this as the time to announce that she is going to leave after Nettie comes with her children, blames Harpo for Sofia ending up in jail. Harpo denies it, but Sofia says there is some truth in the statement.