Mindfulness of death is described in the Maranassati sutta (AN 6.20) which urges a disciple to get rid of unwholesome mental states by reflecting that one's own death can come at any time soon:
"There is the case where a monk, as day departs and night returns, reflects: 'Many are the [possible] causes of my death. A snake might bite me, a scorpion might sting me, a centipede might bite me. That would be how my death would come about. That would be an obstruction for me. Stumbling, I might fall; my food, digested, might trouble me; my bile might be provoked, my phlegm... piercing wind forces [in the body] might be provoked. That would be how my death would come about. That would be an obstruction for me.' Then the monk should investigate: 'Are there any evil, unskillful mental qualities unabandoned by me that would be an obstruction for me were I to die in the night?' If, on reflecting, he realizes that there are evil, unskillful mental qualities unabandoned by him that would be an obstruction for him were he to die in the night, then he should put forth extra desire, effort, diligence, endeavor, undivided mindfulness, & alertness for the abandoning of those very same evil, unskillful qualities.
When you mentioned suicide though, what you may be referring to instead is "contemplation on foulness/unattractiveness of the body", rather than "mindfulness of death". Contemplation on foulness is performed to abandon lust, promoting disenchantment with regard to forms (AN 9.1) -- so that's when it's useful to do it, for as long as lust is present. In the Satipatthana Sutta (MN 10), in the section on mindfulness of body, we read:
"Or again, as if he were to see a corpse cast away in a charnel ground, picked at by crows, vultures, & hawks, by dogs, hyenas, & various other creatures... a skeleton smeared with flesh & blood, connected with tendons... a fleshless skeleton smeared with blood, connected with tendons... a skeleton without flesh or blood, connected with tendons... bones detached from their tendons, scattered in all directions — here a hand bone, there a foot bone, here a shin bone, there a thigh bone, here a hip bone, there a back bone, here a rib, there a breast bone, here a shoulder bone, there a neck bone, here a jaw bone, there a tooth, here a skull... the bones whitened, somewhat like the color of shells... piled up, more than a year old... decomposed into a powder: He applies it to this very body, 'This body, too: Such is its nature, such is its future, such its unavoidable fate.'
... i.e. one of the techniques to "contemplate foulness" is to see the body dead and coming apart.
Some monasteries in Thailand have skeletons in display which can be an aid for such kind of meditation. But one can perform this meditation without a decomposing body:
iii. "And what, Ananda, is contemplation of foulness? Herein, Ananda, a monk contemplates this body upward from the soles of the feet, downward from the top of the hair, enclosed in skin, as being full of many impurities. In this body there are head-hairs, body-hairs, nails, teeth, skin, flesh, sinews, bones, marrow, kidneys, heart, liver, pleura, spleen, lungs, intestines, intestinal tract, stomach, feces, bile, phlegm, pus, blood, sweat, fat, tears, grease, saliva, nasal mucous, synovium (oil lubricating the joints), and urine. Thus he dwells contemplating foulness in this body. This, Ananda, is called contemplation of foulness.
-- AN 10.60
The likely reason you were told it may lead to suicide is because one sutta documents how a group of monks performed suicide after doing this practice (SN 54.9 ).
If one is mentally healthy (e.g. does not have suicide inclinations) and one is mindfull of bodhipakkhiyādhammā (e.g. one is able to direct his mind to joy, tranquility and equanimity), than I don't see danger in it.
Other than that, there was a US zen monk in recent times who, allegedly, was jogging and saw a dead corpse with a bullet wound in the head, thereafter deciding to come back to meditate over the corpse. As it so happens, he got in trouble with the police. So, don't do that.