All of the examples are grammatically correct, and they mean approximately the same thing.
The main difficulty in the phrasing is that the population of the US has little correlation with the war on terror. They are somewhat unrelated facts. India has a population of 1.38 billion people, and hasn't declared a global war on terror.
It's like saying
"The US, having many citizens who play tennis, has declared a war against terrorism."
However, it could make sense if the previous sentences were discussing populations of countries. So, you are segueing from one topic to another topic. You begin discussing terrorism, and also mention the population from the earlier discussion.
In any case, the current stand-alone sentences look confusing, because you appear to be strongly connecting the population with the war.
The issue is more pronounced using "having", and less emphasized with "which". The word "which" separates the topics, and says "here is a possibly unrelated fact, which is being appended." On the other hand, "with" and "having" tend to indicate a connection between the ideas.
in the second sentence should I need to use commas
can I also use with instead of having?
Does "with" mean "using"?
The word "with" has different meanings. Yes, "using" is one of the meanings. So, it's ambiguous. If the sentence clearly made sense with "using", then you might interpret it that way. If the sentence didn't make much sense with "using", then you'd have to interpret "with" to mean something more like "having". If it's difficult for the reader to figure out the ambiguity, that might be an argument for modifying the word choice or even the entire structure of the sentence.