Answer: To begin, I must correct slightly a premise in your question.
does not hold that happiness is the ultimate goal. It holds that happiness is the ultimate purpose in life
This is an important distinction, because Objectivism holds that the concept of "value" depends for its meaning on the concept and phenomenon of life. And so do all other moral concepts. Happiness is a sign of the successful condition of life. It is the emotional state that proceeds from the successful pursuit of non-contradictory values.
There is no guarantee that anyone will achieve a "complete" happiness (i.e., one unalloyed by concerns, dissatisfactions, frustrations, etc.) in life. Rather, it is through living and being guided by moral principles based in the standard of human life that we stand our best chance of achieving a full and rich happiness.
Morality is a code of values to guide human actions. And it is human in its conception and adoption. There is no duty outside of our own lives and happinesses that requires us to act in one way or another. There are merely the facts of our nature and what nature (i.e., reality) makes possible for us. Thus morality is a choice for Objectivists: It draws its weight from our own deep-seated choice to live.
Thus Ayn Rand
summarized her ethics in two sentences in Atlas Shrugged
by writing: "My morality, the morality of reason, is contained in a single axiom: existence exists, and a single choice: to live. The rest proceeds from these."
Suicide is a choice to pursue one's death as a goal and to give up on life utterly. Thus suicide in itself is an abandonment of the choice to live. It would be paradoxical to hold as an Objectivist that one had a duty to choose to live. There is no such duty.
Objectivism has the tradition that suicide might be justified in circumstances when life, or human life, was truly impossible. Ayn Rand illustrated this in Atlas Shrugged by John Galt's willingness to submit to torture and presumably death rather than betray his love or serve an evil system of government. Common examples are life in a torture-camp such as a gulag, or life with a terminal, highly debilitating, and highly painful illness.
I have two points of my own I would add to this tradition. The first is that suicide is a highly personal act. Its moral relevance is most directly for oneself, and its moral significance lies within the life of the person who attempts it. That is the distinctive moral perspective of Objectivism: One's moral failings are failings first and foremost for their impact on oneself. It follows then that it is absurd to criminalize suicide. Suicide is within one's rights. Furthermore, a suicidal person who truly chooses his own death and has only his death as a goal is beyond moral evaluation (suicide bombers are another matter entirely, because their deaths are incidental to the mayhem and murder that is their real aim).
But given this, my second point is that suicide is not an acceptable or proper course so long as one chooses one's life and continues to seek happiness. Suicide is an act of total despair (or total nihilism), and one should never give up on life and value lightly. Death is not an alternative to life; for an organism, death is nonexistence. Death is not a state, it is the absence of states. Death is certainly not the cure for imperfections in one's happiness.
So suicide is not justified by mere emotional distress or ordinary dangers and threats. It is definitely not justified by dissatisfaction. There are many ways in which life can flourish, and many harms which one can survive and learn to live beyond. To attempt suicide in the vast majority of difficult situations is a betrayal of one's own life and values. One should never consider suicide before one has truly thrown oneself body and soul into the attempt to find a way to live: to escape the concentration camp, to find a cure for one's illness, to stick out a wave of depression, to ignore social pressures, to move to a new place, or to seek a new career.