More info needed to give you a true answer but in general 'To' header not used in routing (replay). If the INVITE reached the new port you should get response anyway, even error.
So as I understand problem not in "To" header but in address to replay
Usually UAS sends replay to top 'Via' header or 'Contact' header when direct route used (you're not called record_route for example). This process described in rfc3261 Sections 4 and 18.2.2
So checking first this headers you can understand where replay sent. If you will see replay you will have more info to understand how to fix issue.
Anyway for forwarding packet to a different address/port better use internal core functions rewritehostport or similar https://www.kamailio.org/wiki/cookbooks/4.4.x/core#rewritehostport. Or modules like dispatcher,loadbalancer etc.
It will do all duty work rewriting headers in a true manner for you automaticly
Here is quick examples
rewritehostport("1.2.3.4:5080");
rewriteport("5070");
To change 'To' header uac_replace_to from uac module should be used.
But warn - in most cases it is no reason to do such rewrite and may have unpredictable effects because of tags stored in header. You should know exactly what you're doing.
uac_replace_to("sip:batman@10.0.0.100:5090");
Hope this helps