Is an order necessary in a finite or infinite cartesian product? The elements of $\displaystyle \prod_{i\in I}X_i$ are usually represented by tuples. For this cartesian product to be defined, is it necessary for $I$ to be an ordered set?

No. Paraphrasing from the nLab to match your notation, the product $\prod_{i \in I} X_i$ is the set of functions $f$ with domain $I$ where $f(i) \in X_i$ for each $i \in I$.
If you want an explicit codomain for $f$, you can take it to be $\bigsqcup_{i \in I} A_i$. This notation assumes that the $A_i$ are disjoint, which you can achieve by replacing $A_i$ with $\{ i \} \times A_i$, then dropping the first coordinate after you apply $f$. Note that, again following the same nLab page, I've used (very special) binary Cartesian products in that argument, so you might want to pick your favourite way to define those, as a base case.
