The Wikitravel article for Rio de Janeiro, recommends a 20-30 minutes trekking trail to access the Sugar Loaf for free. Is it safe?
I'll answer my own question after staying in Rio and doing the trekking.
This trail is completly safe in all sense. There are police controls in the first part of the trail (the Pista Cláudio Coutinho) and in the upper part (the cable-car station). In reality, all the area is a militar settlement, so I doubt that anybody try to attack you there.
In the other hand, the trail is not so difficult as the video posted by @DarkLightA shows. Nowadays there are no need of ropes or similar to climb and the main problem is the mud if the previous day has rained (slipper danger).
We take more than a hour to arrive to the "top" so consider the wikitravel time estimation as very optimistic. Also the "top" is not the real top. There are 2 cable-car stations, the first one is where you can get by walking this trail, but the second one is the upper one (but the views are similar).
I've never been there myself, but I'll try to answer your question as well as I can.
There are several YouTube videos that give insight into the hike. Here's one: http://www.youtube.com/watch?v=97nw7rblN00
It appears to be very steep in some parts, with ropes built in to facilitate getting up. However, it is of course difficult to come to a conclusion based on a video.
Furthermore, there is a tour guide who has written about the place, and states:
"Without a doubt, you will feel safe when visiting Sugar Loaf. Not only the cable cars are new and well-maintained, but overall, the infrastructure of Urca Hill and Sugar Loaf (and its surrounding) are satisfying." (http://www.myriotravelguide.com/accidents-on-sugar-loaf-in-rio/)
In the post he is mostly talking about the cable cars, but here he appears to mention the surroundings too, which incorporates the hike up, I suppose.
There was one accident in 2008 with a group of climbers where one unfortunately died, but I believe this was sports climbers rather than hikers, who would have taken a more difficult route. A similar occurrence happened last December, again with a climber, not a hiker.
Overall it seems like it isn't much of a danger to hike up. However, a bit of common sense goes a long way. If you feel uncomfortable, just hike back down and take the cable car up. Better safe than sorry!