What's the origin of 108 being a sacred number?
The origin of 108 in the ancient buddhist scriptures seems to be from the total number of feelings classified in different ways by the Buddha:

&quot;Monks, I will teach you a one-hundred-and-eight exposition that is a
Dhamma exposition. Listen &amp; pay close attention. I will speak.&quot;
&quot;As you say, lord,&quot; the monks responded.
The Blessed One said: &quot;And which one-hundred-and-eight exposition is a
Dhamma exposition? There is the exposition whereby I have spoken of
two feelings, the exposition whereby I have spoken of three
feelings... five... six... eighteen... thirty-six... one hundred and
eight feelings.
&quot;And which are the two feelings? Physical &amp; mental. These are the two
feelings.
&quot;And which are the three feelings? A feeling of pleasure, a feeling of
pain, a feeling of neither pleasure nor pain. These are the three
feelings.
&quot;And which are the five feelings? The pleasure-faculty, the
pain-faculty, the happiness-faculty, the distress-faculty, the
equanimity-faculty. These are the five feelings.
&quot;And which are the six feelings? A feeling born of eye-contact, a
feeling born of ear-contact... nose-contact... tongue-contact...
body-contact... intellect-contact. These are the six feelings.
&quot;And which are the eighteen feelings? Six happiness-explorations, six
distress-explorations, six equanimity-explorations. These are the
eighteen feelings.
&quot;And which are the thirty-six feelings? Six kinds of household
happiness &amp; six kinds of renunciation happiness; six kinds of
household distress &amp; six kinds of renunciation distress; six kinds of
household equanimity &amp; six kinds of renunciation equanimity. These are
the thirty-six feelings.
&quot;And which are the one hundred and eight feelings? Thirty-six past
feelings, thirty-six future feelings, and thirty-six present feelings.
These are the one hundred and eight feelings.
&quot;And this, monks, is the one-hundred-and-eight exposition that is a
Dhamma exposition.&quot;
-SN 36.22, Discourse on One-hundred-and-eight (Aṭṭhasatasuttaṃ)

There is also a reference to 108 Craving-verbalizations in AN 4.199, Discourse on Craving (Taṇhā-suttaṃ).