There are toilet facilities at Sugar Loaf and Urca hill (as well as at Station 1 at street level). They are constantly cleaned and there is never a queue. You will need to take some steps down to reach the toilets at Sugar Loaf, so if you are disabled or have difficulty climbing steps, you should use the no-steps restrooms at Urca Hill before taking the second cable car to Sugar Loaf.
Bear in mind that, overall, restrooms in Rio de Janeiro are clean. For example, any mid-range restaurant in Rio has a reasonably clean bathroom. Most places (restaurants, bars, tourist attractions and other sites) have an exclusive restroom for women and another one for men. However, women should always carry some sort of paper in their purse, since a clean restroom not always have toilet paper. The restaurants staff are usually attentive but it might happen that the moment you go in there is no toilet paper.
Rio de Janeiro is a very clean city and most visitors are surprised, as some (especially those who have never been to South America) may think that it is all messy, dirty and caothic. Rio has more than 6 million inhabitants and despite of that, you will feel at home as soon as you arrive. Your impressions will probably be above your expectations.
To learn how to visit Sugar Loaf in Rio de Janeiro, Brazil, get a copy of Sugar Loaf: the definitive guidebook to visiting the Rio de Janeiro’s most famous hill.