Yes
You can read more about what makes a military settlement a military one by reading DJ 18 although some of the info is a bit outdated, like instead of "Outposts, Forts, Keeps, Strongholds, and Castles" Castles are actually called something else since castles also seem to be a building type so they wanted to keep it from being confusing.
In short, you just need to add the proper defensive structures and then to technically be a military settlement and not just have the buildings that one has, you sign an agreement with the duke making you a baron instead of a mayor.