Also see our page on Nitric_oxide_synthase_and_sex_hormones for more information!
NOS has to do with erections because nNOS is found in nitrergic nerves in the penis (and clitoris) and helps with vasodilation of these nerves. NO is produced by these nerves. Some nNOS has to be found in order for medications like sildenafil and tadafil to act, as they inhibit phosphodiesterase 5 in nitrergic nerves that are moderated by the cyclical GMP which nNOS controls. nNOS raises levels of cyclical GMP, which acts as a vasodilator in the corpus cavernosum. (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3345541/#!po=8.18182).
In other words, nNOS controls erections through nerve action, and therefore it is needed for erections.
However— NO is not the only factor mediating and controlling erection, as cGMP also partially acts independently of NO levels. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2269210/#!po=61.1111
Estrogen may also have to do with cGMP, as ER receptors produce cGMP. (www.sciencedirect.com/science/article/pii/S1226845316300240)