What should one do to have marriage or son early in life? Which deity should be worshipped for this purpose?
In modern times, the most commonly worshiped gods for progeny seem to be Lord Shiva and Parvati. Unmarried people, especially girls, are often advised to keep the Solah Somvaar Vrata or fasting for Sixteen consecutive Mondays to please Lord Shiva for blessing them timely with a good husband. Shiva's spouse, Goddess Gauri is also frequently prayed to for good married life and progeny as evidenced by the festival of Gauri Pujan where married women pray for the long life and well being of their husbands, while unmarried women pray for getting an ideal husband.
In Shrimad Bhagavatam we read about Rukmini praying to Goddess Gauri to make Krishna her husband and it was while she was returning from the temple that Shri Krishna abducted her:
SB 10.53.40-41: Rukmini silently went out on foot to see the lotus feet of the deity Bhavani. Accompanied by her mothers and girlfriends and protected by the King's valiant soldiers, who held their upraised weapons at the ready, she simply absorbed her mind in the lotus feet of Krishna. And all the while mridangas, conchshells, panavas, horns and other instruments resounded.
SB 10.53.42-43: Behind the bride followed thousands of prominent courtesans bearing various offerings and presents, along with well-adorned brahmanas' wives singing and reciting prayers and bearing gifts of garlands, scents, clothing and jewelry. There were also professional singers, musicians, bards, chroniclers and heralds.
SB 10.53.44: Upon reaching the goddess's temple, Rukmini first washed her lotus feet and hands and then sipped water for purification. Thus sanctified and peaceful, she came into the presence of mother Ambika.
SB 10.53.45: The older wives of brahmanas, expert in the knowledge of rituals, led young Rukmini in offering respects to Bhavani, who appeared with her consort, Lord Bhava.
The mention of older women guiding Rukmini implies that the worship of Gauri was a standard practice amongst women who were about to get married. It is quite likely that the same practice continues till date in the form of Gauri Pujan in Maharashtra as Rukmini belonged to the Vidarbha region.
SB 10.53.46: [Princess Rukmini prayed:] O mother Ambika, wife of Lord Siva, I repeatedly offer my obeisances unto you, together with your children. May Lord Krishna become my husband. Please grant this!
SB 10.53.47-48: Rukmini worshiped the goddess with water, scents, whole grains, incense, clothing, garlands, necklaces, jewelry and other prescribed offerings and gifts, and also with arrays of lamps. The married brahmana women each performed worship simultaneously with the same items, also offering savories and cakes, prepared betel nut, sacred threads, fruit and sugar-cane juice.
The fact that even married women performed the worship of Goddess Gauri shows that her blessings were sought even after finding the right husband for marital harmony.
SB 10.53.49: The ladies gave the bride the remnants of the offerings and then blessed her. She in turn bowed down to them and the deity and accepted the remnants as prasadam.
SB 10.53.50: The princess then gave up her vow of silence and left the Ambika temple, holding on to a maidservant with her hand, which was adorned with a jeweled ring.
SB 10.53.51-55: Rukmini appeared as enchanting as the Lord's illusory potency, who enchants even the sober and grave. Thus the kings gazed upon her virgin beauty, her shapely waist, and her lovely face adorned with earrings. ...... On the pretext of the procession, Rukmini displayed her beauty for Krishna alone. Slowly she advanced the two moving lotus-whorls of her feet, awaiting the arrival of the Supreme Lord. With the fingernails of her left hand she pushed some strands of hair away from her face and shyly looked from the corners of her eyes at the kings standing before her. At that moment she saw Krishna. Then, while His enemies looked on, the Lord seized the princess, who was eager to mount His chariot.
Even Shri Krishna worshiped both Shiva and Uma to obtain a son as mentioned in various texts. Section 15 of Anushasan Parva of Mahabharat mentions the following story:
After twelve years had expired from the time when Pradyumna, the son of Rukmini, who is endued with great intelligence, slew the Asura Samvara in days of yore, my spouse Jamvavati addressed me. Indeed, beholding Pradyumna and Charudeshna and other sons born of Rukmini, Jamvavati, desirous of a son, said these words unto me, O Yudhishthira,--Grant me, O thou of unfading glory, a son endued with heroism, the foremost of mighty men, possessed of the most agreeable features, sinless in conduct, and like unto thyself. And O, let there be no delay on thy part in granting this prayer of mine. There is nothing in the three worlds that is unattainable by thee, O perpetuator of Yadu's race, thou canst create other worlds if only thou wishest it. Observing a vow for twelve years and purifying thyself, thou hadst adored the Lord of all creatures (viz., Mahadeva) and then begot upon Rukmini the sons that she has obtained from thee, viz., Charudeshna and Sucharu and Charuvesa and Yasodhana and Charusravas and Charuyasas and Pradyumna and Sambhu. O slayer of Madhu, do thou grant to me a son like unto those of great powers whom thou hast begotten upon Rukmini?
Krishna once again decides to propitiate Shiva and leaves for the Himalayas:
Having obtained the permission of all of them, I thought of Garuda. He immediately came to me and bore me to Himavat (at my bidding). Arrived at Himavat, I dismissed him. There on that foremost of mountains, I beheld many wonderful sights. I saw an excellent, wonderful, and agreeable retreat for the practice of penances. That delightful retreat was owned by the high-souled Upamanyu who was a descendant of Vyaghrapada.
The Shiva Purana. Section 1.5.2 mentions:
Sri Krishna then proceeded to do his penance after getting initiated by Upamanyu with the mantra - Om Namah Shivay. He did a tremendous penance for fifteen months by standing on his toe. In the sixteenth month lord Shiva and Parvati appeared before him after being pleased by his penance. Lord Shiva expressed his desire to bless Krishna.
Krishna demanded eight boon. 1) May his intelligence always remain inclined towards religiousness. 2) May he attain immortal fame, 3) May he has his abode in Shiva's proximity, 4) May his faith and devotion in Shiva be unswerving, 5) May he have ten valiant sons, 6) May he be victorious against his enemies, 7) May all his enemies be destroyed and 8) May be dear to all the yogis. After receiving eight boons from Lord Shiva, Krishna demanded one boon from goddess Parvati May he always be in the service of his parents and the brahmins. Sri Krishna then went back to Upamanyu and narrated the whole story. At last he returned to Dwarka.
The Mahabharat also describes what happened but in a slightly different way:
"The blessed Krishna said, 'Bowing my head with great joy unto that mass of energy and effulgence, I said these words unto the great Deity, with a heart filled with gladness,--Firmness in virtue, the slaughter of foes in battle, the highest fame, the greatest might, devotion to Yoga, thy adjacence, and hundreds upon hundreds of children, these are the boons I solicit of thee,--
So be it,--said Sankara repeating the words I had uttered.
After this, the mother of the universe, the upholders of all things, who cleanses, all things, viz., the spouse of Sarva (Parvati), that vast receptacle of penances said with a restrained soul these words unto me,--'The puissant Mahadeva has granted thee, O sinless one, a son who shall be named Samva. Do thou take from me also eight boons which thou choosest. I shall certainly grant them to thee.
Then Krishna asks Parvati for many things including sons:
Bowing unto her with a bend of my head, I said unto her, O son of Pandu,--I solicit from thee non-anger against the Brahmanas, grace of my father, a hundred sons, the highest enjoyments, love for my family, the grace of my mother, the attainment of tranquility and peace, and cleverness in every act!'
There are many other stories of people being blessed with sons on praying to Lord Shiva such as the birth of Aadi Shankracharya, Markandeya Rishi and judging by Shri Krishna's story, it would seem the worship of lord Shiva and his consort Gauri is prevalent since ancient times to secure a good spouse as well as children.