Depends, [some verses][1] say that there's no heaven for sonless (unmarried) couples on the account of non-fulfillment of the [Pitṛ Ṛṇa][2]. There are [remedies][3] though, for that situation.

Again, like most things within Hinduism, there are varying beliefs.

First, I'll comment about Heaven. 

I'm quoting some verses from smritis which say that even 'life-long' bachelors **got/get heaven**.

> Vishnu Smriti [25.17][4]<br>
>
> मृते भर्तरि साध्वी स्त्री ब्रह्मचर्ये व्यवस्थिता ।
> **स्वर्गं गच्छत्यपुत्रापि यथा ते ब्रह्मचारिणः** ।। २५.१७ ।। <br>
>> [17][5].  A good wife, who perseveres in a chaste life after the death of her lord, **will go to heaven like (perpetual) students,** even though she has no son.
>



> Parāśara Smṛti  [4.31][6]<br>
>
> मृते भर्तरि या नारी ब्रह्मचर्यव्रते स्थिता ।
सा मृता **लभते स्वर्गं यथा ते ब्रह्मचारिणः** ।। ४.३१ ।।<br>
>> 31. If on the death of her husband, a woman remains firm in her chastity, she obtains heaven, on death, **in the manner of the 'Religious Students' (life-long observers of celibacy/sexual abstinence).**

> Āpastamba Praśna II, [Paṭala 9][7], Khaṇḍa 23<br>
>
> अष्टाशीतिसहस्राणि ये प्रजामीषिर ऋषयः । दक्षिणेनार्यम्णः पन्थानं ते श्मशानानि भेजिरे ॥ ३ ॥<br>
> अष्टाशीतिसहस्राणि ये प्रजां नेषिर ऋषयः । उत्तरेणाऽयम्णः पन्थानं तेऽमृतत्वं हि कल्पते ॥ ४॥<br> **इत्यूर्ध्वरेतसां प्रशंसा** ॥५॥<br>
>
>>‘Those eighty thousand sages who desired offspring passed to the South by Aryaman’s road and obtained cremation. Those eighty thousand sages who desired no offspring passed to the North by Aryaman’s road and obtained immortality. **Thus are praised those who keep the vow of chastity**.<sup>**ξ**</sup>’

------

<sup>

**ξ**: However, in footnote [4] in [Praśna II, Paṭala 9, Khaṇḍa 24][8], translator Georg Bühler remarks:
 > ^[4]: **Āpastamba's own opinion is apparently against pure asceticism.**

</sup>

-------

And finally:

> Manu Smṛti  [5.157][9] <br>
>
> अनेकानि सहस्राणि कुमारब्रह्मचारिणाम् ।
> दिवं गतानि विप्राणामकृत्वा कुलसन्ततिम् ॥ १५७ ॥<br>
>> If on the death of her husband, a woman remains firm in her chastity, she obtains heaven, on death, **in the manner of the 'Religious Students' (life-long observers of celibacy/sexual abstinence).**

Acharya Medhātithi in his commentary also concur:

> Many thousands of unmarried students’—**life-long celebates**—‘have gone to heaven’—**do go to heaven**.

-------

# To conclude:

There are verses that say, that even without marriage, the door to Heavens (swarga-loka) isn't closed. So unmarried men can also attain Moksha. 

As regards Moksha: Moksha is not denied to even animals and demons, as I discuss in this answer - https://hinduism.stackexchange.com/questions/50259/can-a-woman-get-moksha/50345#50345 , then what to say of a life-long follower of celibate  brahmacharyam? 

Even a evil demon - Kālanemi, who was fighting with god Vishnu was granted Kaivalya Moksha as a boon, by Vishnu himself, then what to say of followers of Righteous path of Abstinence? 
One can read the Kālanemi being granted the Kaivalya Moksha by Vishnu in [Chapter 14 (Verse 10-11)](https://www.wisdomlib.org/hinduism/book/the-skanda-purana/d/doc365961.html), Section 1 - Kedāra-khaṇḍa, of the Skanda Purāṇa 

Although 'the Householder's path' (gṛhasthāśrama), after studies are completed, is recommended for most people, since it's the foundation (ādhārabhūta āśrama) of our human society. 

As Āpastamba himself notes in Praśna II, Paṭala 9, [Khaṇḍa 21][10]

> चत्वार आश्रमा गार्हस्थ्य, माचार्यकुलं, मौनं, वानप्रस्थ्यमिति ॥१॥<br>
> तेषु सर्वेषु यथोपदेशमव्यग्रो वर्तमानः **क्षेमं गच्छति** ॥२॥<br>
>
> 2. If he lives in all these four (viz. the order of householders, the order of students, the order of ascetics, and the order of hermits in the woods), according to the rules (of the law), without allowing himself to be disturbed (by anything), **he will obtain salvation.**


----------

Related /Duplicate /For further reading : 
https://hinduism.stackexchange.com/questions/8929/will-brahmacharis-life-long-bachelors-get-moksha

  [1]: https://hinduism.stackexchange.com/questions/46295/aputrasya-gatir-naasti-svargo-naivaca-naivaca
  [2]: https://hinduism.stackexchange.com/questions/47804/a-couple-without-a-son-in-any-form-is-never-freed-from-the-pitr%CC%A3-%E1%B9%9An%CC%A3a-and-beco
  [3]: https://hinduism.stackexchange.com/a/46311/17833
  [4]: https://sa.wikisource.org/wiki/%E0%A4%B5%E0%A4%BF%E0%A4%B7%E0%A5%8D%E0%A4%A3%E0%A5%81%E0%A4%B8%E0%A5%8D%E0%A4%AE%E0%A5%83%E0%A4%A4%E0%A4%BF%E0%A4%83/%E0%A4%AA%E0%A4%9E%E0%A5%8D%E0%A4%9A%E0%A4%B5%E0%A4%BF%E0%A4%82%E0%A4%B6%E0%A4%A4%E0%A4%BF%E0%A4%A4%E0%A4%AE%E0%A5%8B%E0%A4%BD%E0%A4%A7%E0%A5%8D%E0%A4%AF%E0%A4%BE%E0%A4%AF%E0%A4%83
  [5]: https://www.sacred-texts.com/hin/sbe07/sbe07027.htm
  [6]: https://sa.wikisource.org/wiki/%E0%A4%AA%E0%A4%B0%E0%A4%BE%E0%A4%B6%E0%A4%B0%E0%A4%B8%E0%A5%8D%E0%A4%AE%E0%A5%83%E0%A4%A4%E0%A4%BF%E0%A4%83/%E0%A4%9A%E0%A4%A4%E0%A5%81%E0%A4%B0%E0%A5%8D%E0%A4%A5%E0%A5%8B%E0%A4%A7%E0%A5%8D%E0%A4%AF%E0%A4%BE%E0%A4%AF%E0%A4%83
  [7]: https://www.wisdomlib.org/hinduism/book/apastamba-dharma-sutra/d/doc116287.html
  [8]: https://www.wisdomlib.org/hinduism/book/apastamba-dharma-sutra/d/doc116288.html
  [9]: https://www.wisdomlib.org/hinduism/book/manusmriti-with-the-commentary-of-medhatithi/d/doc200543.html
  [10]: https://www.wisdomlib.org/hinduism/book/apastamba-dharma-sutra/d/doc116285.html