Owning real estate as a military family is a controversial topic. I can easily find 100 people who claim that buying houses is the smartest choice that they ever made, and I can easily find 100 people who wish that they'd never bought a house because they lost money and endured a lot of stress. Yes, you can make money owning real estate. You can also lose a bundle, and landlording is very stressful for many people.
In many of these cases, a major difference in the outcome actually happened at the outset of the home ownership process. The way in which you approach deciding to buy a house, and deciding which house to buy, greatly impacts how the entire homeownership process unfolds. This is true for all homebuyers, but particularly true for military homebuyers.
For military families, buying a house means that you're extraordinarily likely to be a landlord at some point in the future, either by choice or because you are unable to sell your house at the time that want, for the price that you want. Understanding and accepting this fact is a key to making a smart homebuying decision.
Knowing that you are likely to rent your property, it is essential that you purchase a house that has good rental potential. Good rental potential includes being in a desirable location, having good basic amenities, and having high enough rental market value to maintain positive cash flow. While I have seen families struggle with a variety of landlording challenges, ongoing negative cash-flow is the most common problem. Even if the rent payment will cover the cost of the mortgage, it may or may not include taxes and insurance payments, and there can be additional expenses for property management (which can be up to 20% of the income) and/or maintenance and repairs (for which I budget 20-30% of income.)
Owning rental property will be a lot less stressful, and a lot more successful, if you approach it as a business from the get-go. Planning for the reality of being a landlord before you buy the house will make life easier all around.