In general, I think whether it's okay to drop by depends on the effort required to do so. For instance, when I lived in base housing, I had friends who lived in the neighboring attached houses or across the street. If I wanted to ask them a question or tell them something, I'd just stop by their house, and they'd do the same to me. Conversations were generally short, but sometimes the person at home would ask the other in and we would hang out a bit longer. This was common and natural. If the person was busy, they'd just say so. Or if they didn't want to talk for whatever reason.
If somebody is in the neighborhood or driving close by, I don't think it's a big deal to stop over unannounced, and just say, "Hey, we're on the way <wherever>, just thought we'd say hi/drop off this <item>," whatever. Again, they didn't make much extra effort, so it doesn't make the homeowner feel guilty about saying, "Oh, it's great to see you, but we're in the middle of some things and can't chat. Can I give you a call tomorrow?"
However, I think that anything more than that becomes rude to just come over without calling, and the rudeness increases based on how long you took to get there. I think it's rude if you drove 10 minutes, and ruder still if you drove 5 hours, and rudest if you took an 8 hour plane flight. First, because the greater effort you had to make to get there, the more time you had that you could have certainly found 5 minutes in there to give the person a call (whereas when you're next door or dropping by on your way somewhere, it might be a split second decision and it takes you less time to get to the house than to make a phone call). Also, it puts a greater burden of guilt on the homeowner to turn you away, because they know how much time/effort it took you to get there. Even if they are perfectly justified in turning you away, and they are, it still makes them feel a bit guilty that you went to all that trouble to get there and then they can't see you. So it's manipulation to try to force them to see you. Etc.
I would make an exception on surprise visits to close family/friends who you know would enjoy the surprise. My grandmother lives about 10 minutes away (from my parents' house, which is where I am now), and she'd be thrilled if I came by to surprise her with the kids. I'd take the risk, of course, that she wasn't home or that she was going out just then, but it might be worth the risk for the surprise if she was home. In high school, I had a friend who enjoyed surprising his friends with visits, and he basically knew which of us were fine with it and which of us preferred to be called first. But it's different when you aren't super close and don't know how they feel about it.
Anyway, those are my thoughts.