There were prostitutes with the army, but many wives also accompanied their husbands. Wives cooked and sewed for their husbands, nursed them when wounded, and sometimes stepped in and took their place when they were wounded (as for instance Margaret Corbin who was mentioned in another thread, who took her husband's place at the Battle of Fort Washington in the American Revolutionary War).
.... Smith, who married an English officer in the Napoleonic Wars, accompanied him on almost all his campaigns throughout his long military career.
I'm not sure exactly when the custom of women accompanying their menfolk to war was discontinued, certainly it was still happening in the Crimean War, in the 1850s.
Wellington's army officially permitted 6 women per hundred men as camp followers. These women were "on the strength" and received both pay and rations and in return were expected to launder, cook, forage and nurse the wounded. There was big competition for such a position and most were the wives (officially or otherwise) of NCOs although selection was theoretically by ballot it appears to have been rigged. Many also operated as sutlers, selling "neccessaries" to the troops such as replacement kit and luxuries such as tea and tobbacco. They also performed a vital service after a battle of scavaging the battlefield to remove kit and clothing from the dead for resale or recycling. The actual number was always much larger as "unofficial" women both paid for their own voyage and supported themselves on campaign and local women tagged along often for protection after a town had been liberated. The unofficial women could however not claim a berth on the transports home and many were abandoned after the army left.
There were plenty of adventurous officers wives who travelled on campaign, but I think that Juana Maria de los Doleres de Leon Smith is a special case; there isn't a decent portrait of her on the internet, but there is one in the National Art Museum in Cape Town that tells me that no man would have let a hot number like that out of his sight for a moment.
I am currently reading a book "Jack Tar" about Nelson's Navy. The lot of sailor's wives is even more interesting. As most sailors were not allowed shore leave, the wives ( official or unofficial) would visit the ship while in port. Many "wives" seem to have had several "husbands", obtaining a portion of their pay from all of them and no doubt hoping that only one husband's ship was in port at any one time.
Something that we never see in the movies is that many women stayed on Navy vessels full time as sort of floating camp followers and there is not a single major sea action of the Revolutionary and Napoleonic wars where some wives were not on board some of the ships and sometimes their children too. In fact more than one premature birth occurred during battle.
Very little has been recorded about these women as they were strictly unofficial and not on the muster and even when killed in action rarely gained a mention in the official logs.
According to various memoirs these women not only assisted the surgeons during battle but also acted as powder monkeys and kept the gunners supplied with water. One benefit of their presence on board that is rarely discussed is their protection of the young boys. Most RN ships of the time had up to 10% of their crew made up of children aged from 8 to 12 years old and the risk of paedophilia, despite buggery being the most serious of any offence at sea and deserving of a mandatory hanging, must have been very real. One can bet that these sailors wives could spot the perverts at a hundred yards and kept them at bay.