Before Hamlet actually speaks to the ghost, Horatio reveals (in scene 1) all of the possible reasons why a ghost would possibly appear -- it is a kind of "ghost-lore" lesson for the audience as well. Horation reveals that a ghost could come to:
1. ask for something to be done to give the deceased some ease in his afterlife.
2. reveal some secret that "that art privy to thy country's fate" which the country could deal with if they knew.
3. reveal where the person has "uphoarded in thy life extorted treasure in the womb of the earth."
In the case of the ghost of King Hamlet, he is coming for reason number one. He wants to tell the truth of how he died so that his murder may be avenged. He will still have to suffer in purgatory, but at least his murderer will be punished and he will have his eternal rest come easier knowing that that unfinished business if completed.
The reason this conversation is important is because these are all the legitimate reasons why a ghost may appear, but it should not be forgotten that a ghost may just be the devil in the disguise of a loved one and intending to cause harm. They must proceed with caution when it comes to understanding and believing this ghost.
Hamlet's talking with his father's ghost is very important for the plot. It is actually the exciting force which kicks the plot into conflict.
Since the ghost looks and sounds like his father, Hamlet wants to believe the information he receives. Claudius is not his favorite uncle. Hamlet is told by the ghost that while he slept, Claudius poured poison in his ear. Although his death looked natural, it was actually murder. As his son, Hamlet is obligated to revenge his father's murder.
Hamlet's problem is that he received his information from a ghost and although the ghost looked and sounded like his father, it could actually be the devil tempting him into an action which would cause Hamlet to loss his soul.
As a result, Hamlet decides he needs proof before he does anything. The other part of his problem is that if he does kill Claudius, how does he do it and not lose his soul.
Without the ghost, Hamlet would not know that his father was murdered by Claudius.