Urgent Flag of TCP, Computer Networks The Urgent Flag(URG) is set whenever the sender's Application Layer wants to send some urgent data to the receiver. In this case, the Transport Layer does not wait for enough data to achieve maximum segment size. Now, my question is how do the routers in between recognize that the packet needs to be forwarded urgently(they do not have the transport layer)?
They don't.  The urgent flag doesn't affect the handling of the packet by routers.  The urgent flag is an instruction to the TCP stack on the destination host, not an instruction to routers along the path.