Why does the Quran speak about freeing of slaves for Muslims who want to absolve their sins. Shouldn’t Muslims not own slaves to began with?

Slavery existed at the time of the revelation. Islam encouraged freeing them, and such rulings came to smoothly abolish slavery, rather than abruptly send a big number, and proportion of the society on the streets with no home or income.