It is a meditative absorption or trance, attained by a long practice of dhyāna. It is a spiritual state of being totally aware of the present moment, a one-pointedness of mind.
In Sutra 1:17 Patanjali tells us that samprajnata samadhi comprises four stages: "Complete high consciousness (samprajnata samadhi) is that which is accompanied by vitarka (reasoning), vicara (reflection), sananda (ecstasy), and sasmita (a sense of 'I'-ness)." Sānanda is free from vitarka and vicara.
In Buddhism is a state of concentration and also s the last of the eight elements of the Noble Eightfold Path.
It has here the meaning of 'concentration' which happens long before the above samadhis of Ashtanga yoga.
There are several forms of Samadhi :