The victims included three children aged three, 12 and 16.
Another 14 people were wounded and taken to the hospital, according to a statement from the South African Police Services.
Police did not give details on the ages of those who were injured.
The shooting happened at an unlicensed bar in the Saulsville township west of Pretoria in the early hours of Saturday.
Ten of the victims died at the scene and the 11th died at the hospital, police said.
The children killed were a three-year-old boy, a 12-year-old boy and a 16-year-old girl.
Police said they were searching for three male suspects.
"We are told that at least three unknown gunmen entered this hostel where a group of people were drinking and they started randomly shooting," police spokeswoman Brigadier Athlenda Mathe told broadcaster SABC.
She said the motive for the killings was not clear.
The shootings happened about 4.15am, she said, but police were only alerted at 6am.
South Africa has one of the highest homicide rates in the world and recorded more than 26,000 homicides in 2024 - an average of more than 70 a day.
Firearms are by far the leading cause of death in homicides.
The country of 62 million people has relatively strict gun ownership laws but many killings are committed with illegal guns, authorities say.
There have been several mass shootings at bars - sometimes called shebeens or taverns in South Africa - in recent years, including one that killed 16 people in the Johannesburg township of Soweto in 2022.
On the same day, four people were killed in a mass shooting at a bar in another province.
Mathe said on Saturday that mass shootings at unlicensed bars were becoming a serious problem and police had shut down more than 11,000 illegal taverns between April and September this year and arrested more than 18,000 people for involvement in illegal liquor sales.