Is a mortgage signed without the legal guardian, valid?
The answer may depend upon the specifics of your situation. When you say "entered into by a person", it would be assumed that you mean the person who borrowed the money for the mortgage. If that person, known as the mortgagor, was not competent to enter into that arrangement, then it may be possible for the courts to step in especially if a guardianship was in place and the guardian was not aware of the loan.
Only a legally competent person can create a legal contract. Competence to make a contract means each party has the legal capacity to make a contract. Generally, people are considered to be competent to make contracts if they are over 18 years of age and of sound mind.
A minor (usually, a person under 18 years of age) who makes a contract can rescind or void it, with one general exception. A minor contracting for "necessities" is bound to pay for their reasonable value. A "necessity" can be food or shelter but, depending upon the law of the particular state, it may also include cars or other items. A minor who rescinds a contract gets back whatever the other party received from the minor.
People who are of unsound mind, that is, those who are incompetent because of mental illness or disability, can rescind their contracts, but the standard is high. Usually, a person who is incompetent must have made the contract without understanding that they were making a contract and without realizing the consequences of their action.
Furthermore, people lacking sound mind usually cannot enter into contracts because, the reasoning goes, they lack the ability to understand what they are doing and to create a "meeting of the minds." Persons lacking sound mind generally are those who are mentally handicapped, or impaired by the use of drugs or alcohol, to such an extent that they cannot understand the significance of their acts.