As soon as you have the prerequisite tech, and are in your own borders (and have any resource needed!) and have the cash to pay for it, you should be able to upgrade your antiquated units. General tip: Don't upgrade everything! Only maybe archers to longbows in border cities, or macemen to rifles right before a big attack, etc. If you aren't going to see use from the upgrade, don't waste your money!
So yes, there is a requisite tech, for longbows specifically it is feudalism, but the requisite tech is different for each unit, pretty much. Note that units can only upgrade to the next of it's "type," and even then there are exceptions. Archers to longbowmen or crossbowmen, axes and swords to maces. As for an example of an exception: Horse Archers can be upgraded to Knights, and Chariots to Knights, but chariots cannot be upgraded to horse archers.