" ... Can it be ordained of God?"
The question which has been asked hinges on what is ordained of God.
If something other than what is ordained is done, then it will not be authorised and will fall under condemnation.
NOTE: the above question has not defined what 'marriage' actually is, nor has the question defined what 'sex' means, within the larger term 'same-sex'.
The definition of marriage in the bible is that given first by Adam :
Therefore shall a man leave his father and his mother, and shall cleave unto his wife: and they shall be one flesh. [Genesis 2:24 KJV]
This is reiterated by Jesus of Nazareth :
For this cause shall a man leave father and mother, and shall cleave to his wife: and they twain shall be one flesh? [Matthew 19:5 KJV]
This is how marriage is defined in the bible.
The term 'husband' in both Hebrew and Greek is grammatically male.
The term 'wife' in both Hebrew and Greek is grammatically female.
How these words are interpreted, may be a matter of argument, depending on one's view of language as such, or depending on one's view of the concepts expressed by the language, or depending on one's view of the technicalities involved in the two states.
Similarly, the term 'marriage', itself, may be argued about as to what it is, what it represents, and what is its function, and what are the parameters which govern the state of marriage.
There is no other definition available, in the bible, so this is how marriage must be conducted by persons who follow Jesus Christ and by persons who, though not followers of Jesus Christ, wish to adhere to God's word as made known in the Hebrew scriptures.
Various countries in the world today have a variety of laws and that is an individual matter for the Governments (and the citizens) of those countries.
But those who would wish to follow Jesus Christ have his word to follow as to their conduct in the matter of marriage.
Generally speaking, the word of God to Israel was not addressed to other nations, though nations could follow it, if they wished.
Similarly, the whole breadth of the word of Jesus Christ is not addressed to the nations, though anyone, in any country, may follow his word, if they wish.
Specifically, Jesus' words are addressed, via his apostles, to the nations, but only those who, from among those nations, are baptised (see Matthew 28:20) are further taught and instructed by those same apostles (or the resulting, contemporary, apostolic ministry) to hear and to obey the entire content of the speech of Jesus Christ.
The matter of baptised persons marrying would be a matter of voluntary obedience to the words of Jesus Christ in the context of a Body (the Church) which is instructed by the apostolic ministry, walking in the word and in the steps of the apostles.
Any particular society (called, usually, a 'church') would be voluntarily self-governing and membership would be both voluntary and also a matter of societal approvement.
Thus marriage within that voluntary body would be one of voluntary obedience within the context of that particular society, whether local or more widely corporate.
In the matter of another ordinance (the covering of the head) Paul states certain arguments (the Headship of Christ, the witness of angels, the relative status of male and female in the church) encouraging the practice but ends his coverage of the ordinance by saying :
If any man seem to be contentious (to the ordained requirements) we have no such custom (that is, to disobey the ordinance) neither the churches of God. [1 Corinthians 11:16 KJV]
Thus Paul the apostle of Jesus Christ makes it clear that what the churches regard as a customary ordinance is what they will do, irrespective of others who do not agree with it.
Volition works both ways : one may voluntarily include oneself by obedient agreement or one can voluntarily exclude oneself by refusing what is enjoined, by custom, upon all.
It is also relevant that in that same passage (addressed to the church in Greece) regarding an ordinance affecting male and female, Paul states 'doth not even nature teach ...' so it is clear that Paul sees certain matters (in context, regarding male and female) to be judged according to what 'nature' teaches.
In another epistle, addressed to other readers (the church in Rome) Paul dictates to Tertius, his scribe, that he regards certain things as a matter either of 'natural use' or behaviour that is 'against nature'.
Thus if one wished to follow Jesus Christ in the way in which Paul did so, one would have to take the matter of 'nature' (or rather what Paul regarded as 'nature') into account.