Among those poorly treated were bereaved people whose financial issues should have been better assessed.
The City regulator, the Financial Conduct Authority (FCA), said Barclays' poor treatment of its customers "risked making these difficulties worse".
The bank has compensated those affected, paying over £273m to 1.53 million customer accounts since 2017.
The FCA said Barclays knew about many of the shortcomings in its systems and controls as early as 2013, but failed to adequately resolve them until late 2018.
"Firms must treat consumer credit customers fairly, including when they find themselves in arrears," said Mark Steward, of the FCA.
"We will take action against unfair treatment, or where firm systems expose customers to the risk of unfairness. While this case predates the pandemic, this message is especially important as the impact of coronavirus continues to affect household incomes and budgets."
The problems affected individual current account holders and small business customers between April 2014 and December 2018.
The regulator found these people had been poorly treated when they fell behind on credit repayments.
They included people whose loved ones had died, who were not given sustainable or affordable debt repayment plans.
The bank failed to contact people quickly enough, leading to more debt charges.
Staff did not have appropriate conversations with people in order to understand why they were facing financial problems.
Then, when they put repayment plans in place, they were delayed, included errors, had mistakes with payments, and charged interest or fees during a breathing space hold on payments, the FCA said.
The bank also missed signs that some of these customers were in a vulnerable situation "in a significant number of cases".
A Barclays spokeswoman said: "Barclays is a responsible lender and we strive to achieve good outcomes for our customers.
"We would like to apologise to those customers for not providing the level of service we should have."
She added that the bank had made changes to its systems, processes, and training to correct the issues and that "the vast majority of customers who were impacted have already been contacted".
Any firm offering credit should properly understand customers' financial difficulties and show forbearance to those in arrears or in financial trouble.
Otherwise, they could end up trying to pay their debt to the bank instead of a priority debt, such as a mortgage, council tax, child support and utility bills.
Never be afraid to try something new…
An amateur built the Ark that lasted forty days and forty nights; professionals built the Titanic that sank.