Members who have dependents usually have the option of living on-base in military family housing for free, or off-base and receive a monthly housing allowance. Members who are assigned to locations where dependents are not allowed to travel at government expense (such as basic training, and some unaccompanied overseas assignments) can live in the barracks for free, and still continue to receive the housing allowance (for the location of their dependents), in order to provide a household for their family members.
At some bases, members may not have a choice. When I was stationed at Edwards Air Force Base, in California, all First Sergeants and many commanders were required by local regulation to live on-base. This is because the Wing Commander wanted his senior leadership readily available at all times. The closest livable off-base town is Landcaster, which is about 45 miles away from the main base.
To live in military family housing, you must be living in the house with your dependent(s). There are exceptions for those who are temporarily deployed, or who are serving a remote overseas tour. In these cases, the family members can continue to live in military family housing, while the member is away. If you are divorced or unmarried and you have physical custody of a child or children for at least 1/2 the year, you qualify. If you are married and you and your spouse separate (assuming no children are living with you), and your spouse moves out, you must terminate your family housing within 60 days. Coversely, if you move out, your spouse/family lose the military housing entitlement, as well (again, within 60 days).
On-base family housing is a crap-shoot. Many bases have outstanding family housing. Other bases have on-base housing that is badly in need of renovation or replacement. Many bases today have "civilian owned" military family housing. Civilian companies are contracted to build, operate, and maintained family housing, and "rent" it only to military members, in exchange for their housing allowance. Many overseas bases have high-rise (condo-style) on-base family housing units.
Unlike barracks living, on-base family housing is rarely inspected, unless there is a complaint, or until you move out. However, on many bases, the housing office sends an inspector out to drive around once a week to make sure you're cutting your grass, as required. If not, you get a "ticket." So-many "tickets" in a designated time, and you're forced to move out of on-base family housing. If you live off-base, you probably won't have an inspector driving around, telling you that your grass is 1/2 inch too long (your landlord may have something to say about it, however).
Many bases have a waiting list, ranging from one month to a year for family housing. Therefore, if you want to live on-base, you may have to live off-base for awhile when you first get there. In such cases, the military will move your property to your off-base residence, and then move it to your military family housing when you relocate there. It doesn't work the other way, however. If you live in on-base family housing, and voluntarily decide to move-off base (let's say you buy a house, or something), the military won't pay for your property move. Another thing to keep in mind, if you have to live off base for a time, while waiting for a military family house to become available, is to make sure your off-base lease includes a "military clause" that will allow you to break the lease, without penalty, if you move on-base. The Servicemember's Civil Relief Act allows you to break a lease in the event of reassignment to another base, or if you deploy for 90 days or more, but moving on-base is considered a "voluntary move," and is not covered under the act.
It used to be a major pain in the neck to move out of military family housing. When you move in, the military turns over to you a spotless (and I mean SPOTLESS) housing unit, and expected you to return it to them in the exact same ultra-clean condition. When I moved out of my first military family house, it took me three times to get it clean enough for the housing inspectors. I swore I would never do that again, and I didn't (the other two times I lived in military housing, I hired a cleaning service to clean when I moved out). I've been told those days are now gone. These days, there is a pre-inspection, and the inspectors tell you exactly what to do. For example, if they plan to re-paint, you won't have to waste any time cleaning the walls. If they plan to replace the linoleum, you won't have to remove wax build-up from the floors. Some bases, I understand, now have contract cleaners that they use, once you move out, and they do the maintenance, and you don't have to hardly clean at all.
If you live on-base, you will be closer to support functions, such as the base exchange, commissary, youth center, or child care center. Many people like the idea that all their neighbors will be military members. Others may prefer to live off base among civilians, and "forget" they're in the military when they're not on duty.
Some bases have schools right on base (either DOD-operated schools, or part of the local school district), at other bases you may have to bus or drive your child to an off-base school, so this is another factor to consider.
Some members may wish to live off-base in order to buy a house, rather than give up their housing allowance to live on-base. Personally, I always avoided buying a house while in the military. I've seen too many people who bought a house, only to receive change of assignment orders, and then have to go through the stress of selling it (in addition to the normal re-assignment stresses). Some, I've seen, were not able to sell their house, and wound up having to pay rent at their new location, and a mortgage at their old assignment (the military doesn't pay a dual housing allowance).