You can check bus schedule here:
I would just take a taxi to old town at that hour. I don't recall the cost, but it was not exorbitant.
Likely you will have to take a taxi at that time.
The last airport bus route no. 16 from Bari Airport to Bari Centrale (main train station) departs at 10.10pm
Metro line FM 2 connects the airport with the central railway station. Travel time is 15/20 minutes. Bari Aeroporto - Bari Centrale. Tickets are 5€. It is very easy to get to from the arrivals hall.
We recall the last train is around 23.30 on weekdays, but check using their website:
From Aeroporto to Bari C.Le (= Bari Centrale).
Safe and happy travels.