By train is the obvious choice. Ribe is on the local Vestbanen line; direct trains run from Esbjerg (35 minutes, the nearest main-line hub) and there are good connections through Esbjerg or Bramming from Copenhagen (about 4 hours including the change) and Aarhus (about 3 hours). The station is a five-minute walk north of the old town.
By car, Ribe is just off the E20 motorway via Esbjerg; about 3 hours from Copenhagen via the Storebæltsbroen bridge, 4 hours from Hamburg. There are pay car parks at the edge of the old town; driving in the centre is restricted.
By air, the nearest airports are Billund (50 minutes by car or bus, well-served by European low-cost carriers) and Hamburg (about 2 hours by car).
By ferry, the Esbjerg–Fanø ferry doesn't help directly, but the Esbjerg–Harwich route (now discontinued, alas) used to make Ribe a popular first stop for British visitors arriving in Denmark.