From Mark Anthony Neal, professor of African and African-American Studies at Duke University (2007):
Also, saggin' is nothing new. Long-time observers of urban youth
culture can recall seeing examples of saggin' at least 20 years ago.
In those days, saggin' was linked to prison culture and the fact that
prisoners were not allowed to wear belts.
For many of those first
generation of saggers, the style was an emblem of their hardcore
status.
but he also mentions:
Within gay subcultures, saggin' can be read as a sign of availability.
From BBC News:
The practice of wearing low-slung, baggy or sagging trousers is
thought to have begun in US prisons.
Inmates were issued with
ill-fitting clothes and denied belts due to fears over use as weapons
or suicide aids.
From The New York Times:
Sagging began in prison, where oversized uniforms were issued without
belts to prevent suicide and their use as weapons.
From Snopes:

It seems that the origin of "Sagging " is not known for sure, but the prevailing opinion seems to be that it began in prison, due to inmates not being allowed to wear belts.