Depends on which country you are in, in most western countries,
following the US model, it is very illegal, on par with heroin,
although the substance in itself poses no physical danger, is very
safe, and in most cases(as with most benign hallucinogens), induces
positive life changes.
It is on the other hand legal for religious purposes for some
churches in the US, Brazil, and wierdly enough it is legal in the
Vatican state, which also houses plenty of pinecone artwork which
symbolizes the pineal gland, which is thought to be the gland which
produces endogenous DMT.