GAP fields were invented in the early 2000’s by a scientist in Team Rocket as a means to prevent the intrusion or escape of ghost Pokémon in secure areas. The technology began as being Rocket-exclusive, but it was eventually replicated by outside technicians and put into public production and use.
The barriers are usually in the form of a wire mesh inside of a wall and doors that is charged with electricity to produce an industrial strength magnetic field (strong enough to be impervious from outside electric interference) keyed to a very specific frequency that interferes with certain abilities. Such a field can be switched on and off in the proper circuit breaker or other control unit, but they are usually well-protected by passwords and the like.
No ghost- Pokémon or Pokemorph- can pass so much as an inch through a GAP field by phasing, though they can of course walk through them in a solid form, such as through an open door shielded by such a barrier. In addition, phasing can occur within such a field, just not through a wall or door or such that is shielded.
In addition, some Psychic abilities are inhibited by such a field- it’s impossible to Teleport into or out of an area shielded by a GAP field. If someone attempts to ‘port into a field-protected area, they will end up just outside the field- which could be in the next room, or more likely, outside of the building. If they try to Teleport out of an area with a GAP field, they will fail to leave the inside of the field. In addition, a Psychic-Type can’t sense the presence of others within or through such a field or read minds.
Most significant public buildings and bases have such fields- however, they are prohibitively expensive, so only the more affluent businesses and residences can afford this manner of security. However, most consider the investment worth it in order to stave off possible intrusion or vandalism by Ghost or Psychic-types, or others with the Teleport move.
Smaller versions of the fields are available in the forms of shackles and nets and the like in order to apprehend or further imprison ‘morphs of these types. However, they require a power pack to provide the charge, and these smaller GAP field units are even more expensive than the large sorts that surround whole rooms or buildings, since the field is difficult and costly to compact into such a smaller form.