Someone who is basically good hearted but lacking social graces and respect for the law.
This term is often used to describe people on the edge of the criminal fraternity who, while they may not commit serious crimes themselves, probably know people who do.
The English comic actor, the late Sid James, typified the type on and off stage and was typecast in such roles. For example, he played Sir Sidney Ruff-Diamond in the Ealing comedy Carry On Up The Khyber. That was quite appropriate for this phrase as it turns out - Sid James worked in a diamond mine in South Africa before becoming an actor.
The phrase is clearly a metaphor for the original unpolished state of diamond gemstones, especially those that have the potential to become high quality jewels. It is more commonly expressed in the form 'rough diamond'. The first recorded use in print is in John Fletcher's A Wife for a Month, 1624:
"She is very honest, and will be as hard to cut as a rough diamond."