Visits occur when an NPC villager asks to come to the player's house or requests that the player come to theirs. These requests will occur occasionally and can be accepted or declined. If the request is accepted, the villager may want the visit to happen right away or ask the player for a time to meet.
In New Leaf
If a villager wants to visit a player's house, the player must be inside their own house at the time that the villager is supposed to arrive. The visitor will arrive within a few seconds to a minute. If the player is going to a villager's house, then the player must go into the host's house at the proper time. Nothing much happens during a visit; the villager will just walk around the house. The villager will make comments on the player's house or tell the player about their house, possibly offering the player a piece of furniture.
A villager visiting a player's house will take their leave after being there for around 5 minutes, longer if the house has multiple rooms. When the visitor wants to see a different room, they will say "Hey! So can I check out every room?", "What are the other rooms like?", etc. However, if the player lingers in a single room for too long, the visiting animal will leave after a while even if they have not seen every room. Players can leave a host villager's house by simply walking out the door, which makes the villager ask the player what they think of the host's room. If an animal is visiting the player's house, the player can cut the visit short by walking out the door. After a visit has passed, the player will receive a letter the next day from the villager, thanking the player for coming over or having the villager over. A present will be attached to these letters.
If the player is not inside their house at the time a villager is supposed to visit, the visit will be canceled. If the respective villager is talked to after that, they will be disappointed and will possibly get angry. This conversation can be avoided by not talking to that certain animal for the rest of the day. Occasionally, although apparently rather uncommon, a villager who is supposed to visit a player's house will not show up. If that villager is talked to after that, they will apologize and give an excuse. A similar situation can occur when the player is supposed to visit a villager's house, but the host is absent.
A visit to a player's house can be "innocently" avoided by just closing the 3DS while the player is inside their house. If the player opens the 3DS again a while after the visit was scheduled, the visitor will not show up. This will not trigger an angry response from the one who was supposed to visit, but rather an apology for not showing up on time.
On occasion, a villager might stop by a player's house for no real reason, even if no visit was scheduled. The visiting animal might give a present to the player, normally furniture. These small visits last for a shorter time than a scheduled meeting. The visitor also will not follow the player into other rooms as they would if it were a normal meeting.
In New Horizons
In version 2.0 of New Horizons, villagers can once again invite players to their houses or ask to come to the player's house. When a player is invited to a villager's house, the player cannot leave until they have hung out with the villager enough. When talked to, the villager will allow the player to buy furniture items in their house. When a villager is at a player's house, they will give the player the secondary fruit of their town as a gift. They may also play the High Card Low Card minigame which will reward the player with an item if they win the minigame. Like in New Leaf, they may occasionally stop by the player's house for no reason; they will not follow the player into other rooms in these types of visits. Also, villagers will leave the house immediately should the player's house be infected with cockroaches. Villagers may sing along to a song if music is being played.