This legend was probably imported from China in the Heian Era (794-1185), and its associated Tanabata Festival has developed through the centuries. The story involves the stars of Vega and Altair and their apparent proximity to the Milky Way.
Members of royalty were, of course, associated with the heavens; Tentei (the emperor) being centered at the North Pole. One day, the emperor's daughter, Orihime, was sitting beside the river of heaven (Milky Way). She had been weaving because her father, the emperor loved the beautiful clothes that she made. On this particular day, she was very sad because she realized that she had been so busy that she didn't have time to fall in love. Her father, Tentei, the ruler of the heavens, felt sorry for her and arranged a marriage with Kengyuu (who lived across the river, the Milky Way). Their marriage was one of sweetness and happiness from the start; and everyday thereafter they grew happier and happier. But Tentei became very angry, because in spending so much time in her happy marriage, Orihime was neglecting her weaving. Tentei decided to separate the couple, so he placed them back in their original places, separated by the Milky Way. On only one night of the year would he allow them to meet, the 7th day of the 7th month. Every year on that day, from the mouth of the river (the Milky Way), the boatman (of the moon) comes to ferry Orihime over to her beloved Kengyuu. But if Orihime has not done her weaving to the best of her skills and ability, Tentei may make it rain. When it rains, the boatman will not come (because the river is flooded). However, in such a case, Kasasagi (a group of magpies) may still fly to the Milky Way to make a bridge for Orihime to cross.
Related to this legend, ancient Japanese celebrated the festival of Tanabata on the 7th day of the 7th month each year (lunar calendar). The 7th day of the 7th month generally falls in August or September in the Gregorian calendar. At this time of year, of course, the constellations of Lyra and Aquila are prominent in the evening sky with their major stars (Vega and Altair) separated by the Milky Way. The 7th day of the 7th month also, of course, finds a waxing crescent moon reaching its first quarter. If it is not raining, both Orihime Boshi (Vega) and Kengyuu (Altair) are quite conspicuous at the time of the Tanabata festival.
Relevance to Urusei Yatsura
The Moroboshis are blessed (or cursed depending on how you look at it) to have a Wishing Star fall from the sky on Tanabata and offer to grant them three wishes.