Many people obtain loans to buy real estate. The term “security instruments” is a catch-all phrase used to describe these loans, whether they are mortgages or deeds of trust, and the associated promissory notes. These documents secure debt with a lien on the real property identified in the loan papers, by transferring title to the lenders until the loan is repaid. They also set out the terms and conditions of the loan agreement between the lender and the borrower. The loans might originate with a bank, another type of lender, or come from a federal agency, such as the VA, Fannie Mae or HUD.
Almost all lenders include a “due on sale” clause in their security instruments for real estate. Why is this kind of provision necessary? Basically, they need to keep track of their assets. They approve loans with the expectation of repayment, so the due on sale clause exists primarily to protect the lender.
The Garn-St Germain Depository Institutions Act of 1982, 12 USC § 1701j–3, “the Act,” defines a due on sale clause as “a contract provision which authorizes a lender, at its option,” to accelerate payment on the remaining balance due under “the lender’s security instrument if all or any part of the property, or an interest therein, securing the real property loan is sold or transferred without the lender’s prior written consent” (a)(1). 
This rule also allows for exemptions to the acceleration clause. These may involve a transfer to a family member, a surviving owner under a joint tenancy or tenancy by the entirety, a short term lease, or otherwise as described in section (d) of the Act.  The key language, though is described above: “without the lender’s prior written consent.”
Depending on the situation, the lender will issue a document authorizing the change in circumstance, or they might require other actions. Note that triggering a due-on-sale clause may be inconvenient, but not illegal. Concealing the facts that would activate such a clause could possibly be illegal, and may result in criminal prosecution at both the state and federal levels .
Ultimately, the best way to avoid activating the due on sale provision is to contact the lender before making any changes to the title.