When the baby cries, she pays close attention to whether her needs usually get met or not. If they do, she not only learns to love the person who meets those needs, she also learns that people will love her and help her in general and that the world is more or less safe for her.
If her needs are consistently not met, she learns the opposite- that no one will help, that the world is not safe, and that she's on her own. Attachment is extremely important in the long-term mental and emotional well-being of the child. A child who does not succeed in forming a strong attachment at this crucial age may never be capable of truly loving or being loved by another human being.
Attachment is also important for the child's ability to explore and take risks, as young children without strong attachments tend to be timid and clingy while children with strong attachments are often willing to go out an explore the larger world, confident that they are basically safe. Attachment is one of the most important factors in parenting a young child.