There is no luggage storage in Windsor, but the Castle website now says it can store luggage in a secure cloakroom in the China Museum, HOWEVER any luggage you want to store there will have to fit through the airport style security scanners, and thus needs to be carry on sized. If it does not fit you are just flat out of luck.
This is a departure from the past, in that Windsor Castle used to outright say they did not have facilities for luggage storage.
More info here:
Given you can’t go direct from Windsor to Bath- see if travelling from, back to and then onwards via Paddington fits your timing- there is a left luggage operation at Paddington. Not the most efficient trip - but it works?
But the time is much the same from Windsor, as if they took a train from Paddington with no stops to Bath--both are about 1 hour and 20 minutes.
But I agree, just for the convenience factor, and not having to lug bags to and from the train, I would do Windsor as a day trip on a different day than OP's trip to Bath.