How do I prevent older paint peeling off drywall when applying new paint?
Ooh. this problem is one not easily answered without more info:

Heat Blisters:


Paint bubbles can show up pretty quickly, from within a few hours to a few days after application. The blisters are only in the top coat of paint and appear most often in oil-based paint. A quick rise in temperature, like sunlight shining directly on the newly painted wood, causes a thin skin to form on the outer surface of the paint. The skin traps inner wet paint that produces vapor when it heats up. The vapor expands and causes the paint to blister from underneath.
To repair blisters, scrape them off, smooth the edges, and repaint, being sure to avoid direct sunlight while the coat dries. Experts suggest establishing a painting order that follows the sun around the project. Thick coats and dark colors are more likely to blister than light colors and thinner paint.


Water Blisters:


Moisture causes problems for paint. Rain, dew, ice, and snow on the outside or vapor and moisture buildup from the inside can cause problems with exterior paint. When moisture penetrates the paint, blisters can form and paint can peel. Moisture blisters, unlike temperature blisters, go through all coats of paint down to the wood. To stop moisture blisters, you must locate the source of the moisture and repair it. Improper construction techniques and lack of flashing can cause outside water to pool at joints, on window sills, frames, or on the end grain of the wood. 


Intercoat Peeling 


Another type of peeling occurs when a newer coat of paint separates
from the coat underneath. An inadequately prepared or dirty surface
is one cause for a weak bond. Another is that the two paint layers
are incompatible. For example, an oil-based paint may have been
applied over a latex-based paint. They are incompatible and can peel
away from one another.

Peeling can also occur when too much time has elapsed between
applications of the primer coat and the top coat. If more than two
weeks separates the primer application and the paint coat, the
primer’s surface can begin to break down and prevent proper bonding
with the paint. To correct the problem, you must remove the paint and
properly clean the surface.


Cross-Grain Cracking or Crazing 


Too many layers of paint or one layer that is too thick can result in
an interconnected, uneven pattern of cracks. The thick paint is
unable to expand and contract with the wood, so breaks result,
starting in the outer layers. If the problem is not corrected,
moisture enters the paint layers, causing deeper cracking and
deterioration. 

Surface cracking may require sanding and repainting. Deeper cracks
will require a complete removal of the old paint. Once the wood is
bare, clean it and treat it with a paintable, water-repellant
preservative. Once the preservative has dried, apply a primer and top
coat at the recommended spread rates.


Chalking 


Some exterior paint has a powdery coating. Chalking comes from the
disintegration of the paint resin due to exposure to the sun’s
ultraviolet rays. This gradual deterioration is how paint is supposed
to age. Too much, however, can cause discoloration of other painted
areas below as rain washes off the chalk. It also signals that the
paint is rapidly deteriorating.

Chalking was more of a problem with older paints that contained
excessive pigment for the amount of binder, but other triggers
include the failure to properly prime and seal exterior wood,
spreading the paint too thinly, or thinning the paint too much. To
correct excessive chalking, the surface must be cleaned and
repainted.


Staining 


A stain is typically caused by moisture. The most common source is
rusting metal nails or anchoring devices in the wood. The second
cause is a chemical reaction between moisture and wood, such as red
cedar, which results in color buildup on the surface.

Rusty nails can be hand sanded and coated with a rust inhibitor and
finish coat. Unless the wood is too fragile or the exposure of the
nail head is related to the original construction system, it’s best
for nail heads to be countersunk, primed, and filled before painting.
Stains from wood extracts need to be cleaned, rinsed, dried, and
primed with a stain-blocking primer before applying the finish coat.
Check with a knowledgeable local paint retailer for the best cleaning
mixture.


Incompatible Paints


If you are using two incompatible paints.  Generally, paint
manufacturers like to match primers with top-coats This is more
applicable when painting metal surfaces (enamel paints). The reason
for this is that there are a few acidic or highly alkaline or soluble
salts primers, which could be water based, oil based or acrylic some
combinations don't play well!. generally sticking with a certain type
is ok i.e water based primer with water based top coat.


source: Dictionary of causes of paint blisters