Yes, it would definately make more sense to start from Portsmouth Harbour & then go to Bath before picking up the hire car. The trains should take about 2 hours 20 minutes to do the trip. They are Express Sprinters on this route. Watch out for any coaches with open flap windows as that is a sure sign that the air-con is not working - so find a coach with closed windows. The trains are usually only 3 coaches and can get quite busy. (5 coach trains are due on this route in 2017>18).
The cheapest you can do Portsmouth Harbour to Bath is £10.50 one way > providing you pre-book ahead a specific train around 10 weeks ahead. Even getting a ticket the day before should get you a ticket for around £14 and you can reserve a seat. (If you don't like your seat, you can go to another one that has no reservation tab). Book tickets with GWR and you will get a booking number. Use same debit card in UK - insert into ticket machine - type in Booking Number & out will come the tickets. Alternatively, take booking number to staffed office. Please check the following site for engineering works as the Bath area is being electrified.https://www.gwr.com/travel-updates/planned-engineering
This site is good for finding train times & fares:> www.nationalrail.co.uk
If driving, you have 2 routes. One involves driving around the N of Southampton on M27 & then M3 towards Winchester - which is worth a visit. Then A34 north to join M4 near Newbury and then west before dropping down into Bath - which is congested.
The other route involves poorer roads (not dulled) via Salisbury - worth a visit > and Stonehenge is also 'just a few miles north'.
http://www.theaa.com/route-planner/index.jsp
Suggest you look at the roads on Google Earth.