The two preceding answers describe correctly that there is no network-wide requirement to order inputs or outputs, but I don't agree that the "order doesn't matter".
Early on, many wallets did order their inputs and outputs, e.g. the inputs were in the order the addresses were created, in the order that they got picked by the wallet's coin selection, or simply sorted by age. Similarly, outputs would often list the recipient outputs first and the change output last. Such patterns are a privacy leak as they fingerprint the used wallet software, and may allow observers to learn additional data about the user's finances.
If everyone shuffled the inputs and outputs of a transaction properly these issues would be mitigated. However, it can be difficult to recognize whether an order is random or follows a more complex pattern. From what I understand, this is why BIP69 instead suggests a global adoption of sorting inputs and outputs lexicographically. Again, everyone would be indistinguishable if they all sorted the same way, and it would be much easier to audit, test, and notice wallets that don't adhere to such a standard.
Great answer, thank you for pointing me in the direction of BIP69 – K Stewart – 2019-11-30T21:24:14.343