The answer is yes.
Let's see an example.
Suppose that you have the following triangle:
This triangle has different units. Suppose that we want to find the sine function for the angle drawn. If the triangle doesn't have the same units in all its sides, we would obtain the following:
Which is not defined.
But, if we use the same units in all the sides, the problem could be well solved.
So, the lengths of the sides of the triangle have to have the same units.