Yes, Metamagic can be used on ritual spells from any source.
Most metamagic options specify that you can use it "when you cast a spell [...]", and casting a ritual version of a spell still counts as casting the spell.
Certain spells have a special tag: ritual. Such a spell can be cast following the normal rules for spellcasting, or the spell can be cast as a ritual. [...] To cast a spell as a ritual, a spellcaster must have a feature that grants the ability to do so.
Casting a spell as a ritual just removes the use of the spell slot. If Metamagic required a sorcerer to be casting a spell using a spell slot, it would specify so.
Furthermore, the spell you affect with Metamagic can be cast from any source / spellcasting class feature. If metamagic could only influence sorcerer spells, each of the options would instead say "When you cast a sorcerer spell [...]", which does not appear in Metamagic; such wording does appear elsewhere in the class for reference, such as with Spellcasting Focus from the sorcerer's Spellcasting feature:
You can use an arcane focus as a spellcasting focus for your sorcerer spells.