Matera (which is actually just over the border in Basilicata rather than in Puglia, but is very close to Gravina and Altamura) is a unique place even in Italy. If you get an opportunity make sure you see it. It is not much more than an hour's drive from Ostuni. You can also go by train from Bari, an hour and a half on a small local train which crosses the bleak Murghe plateau before reaching the dramatic site of Matera - this trip gives a real feel for Matera's isolation.
For centuries, the people of Matera inhabited a series of natural caves on the side of a river gorge. The buildings at the cave entrances conceal extensive underground rooms where people lived, worked and kept animals. The cave dwellings (called sassi) had no sanitation or water supply, were under constant threat from cholera etc., and regarded as a shameful slum by the authorities. Eventually, in the 1950's, the Italian government forced the remaining population to leave to live in new housing nearby. The old areas stagnated until a relatively recent revival as a tourist attraction and UNESCO World Heritage site.
Matera will surprise you by its size. You can view the two main sassi areas from viewpoints in the newer part of the town which separates and overlooks them. Walking through the sassi is no problem as long as you don't object to steps and slopes (certainly no tougher than Ostuni in this respect). Various people offer guided tours, and some guidebooks suggest that there are problems in undertaking 'do it yourself' walks, but this is a myth. The maps of the town available in lots of places give some walking routes which are very good and easy to follow.
There are some reconstructed sassi houses with lots of artefacts etc. on display. There are also lots of cave churches, all of which charge for entrance, but there is a joint ticket if this is a particular interest. There are a few restaurants and bars, some of these operating in caves within the sassi.
It is best not to rush Matera, so if you go for a day leave early. A good option is to stay there in a cave hotel. This is not as bad as it sounds, the rooms are well equipped and usually have a dehumidifier to keep any damp at bay. Be ready to tackle steps up or down to its location in the heart of the sassi area - but well worth the trouble.