tl;dr: No matter what you do, you will be in good company. Purely as far as order goes male-first seems to be the traditional preference and seems to match linguistic expectations of most users. Despite this modern western tech companies seem to opt for female-first.

Cultural connotations

A lot of the answers dive into western liberal notions about sexuality and gender and the perception of the question itself. Although this is an interesting and fascinating philosophical question it's hardly relevant for non-western cultures where asking for sex is still a normal question. This can be normal because of grammatical reasons (addressing a person without knowing their gender is not possible in some languages (or at the very least most indo european languages don't allow you to talk about a person without knowing their gender)) or simply because a lot of cultures embrace different gender roles.

Especially if you are addressing a purely western audience it is however a good idea to consider whether you need this information. From a UX perspective decreasing friction by not including the question (or making it optional) is advantageous, however it comes at its own cost.

So, back to the actual question

Usage across texts and the entire internet

Without a particularly strong UX reason to deviate from the norm the best rule of thumb is to match the expectations the user will have.

One way to get an impression of user expectations is by looking at Google ngrams which shows term usage in books (only including a minimal amount of forms of course):

Another option is looking at google search results: 21,100,000 vs 570,000 results respectively for "male or female" or "female or male".

I checked the same for Dutch, German and Slovak and this seems to hold true across a variety of western cultures, so from that point of view mentioning 'male' first seems to be the best choice.

Usage exclusively on registration forms on most popular websites

Secondly I wanted to take a look at what most popular (as defined by the Alexa site ranking) websites use:

Google: non-binary dropdown form with 'female' first

Youtube: see Google

Facebook: binary with 'female' first

Baidu: 'male' first

Wikipedia: doesn't ask

Yahoo: free form input with suggested option list with 'female' first

Google India: see Google

Amazon: doesn't ask

Tencent QQ: 'male' first

Google Japan: see Google

Windows Live: non-binary dropdown, 'male' first

Taobao: Need Chinese phone number to get to 'personal information' part of the form

VK.com: 'female' first

Twitter: Doesn't ask

Instagram: Doesn't ask

Hao123: See baidu

Sohu: Doesn't ask

Conclusion

My conclusion from this is that: 1) Traditionally 'male' first had a strong preference 2) Silicon Valley companies seem to strongly prefer 'female'-first.

Either way: You will be fine whatever you pick and considering the diversity of orders and inputs types on popular registration forms it's safe to assume that users will not be too confused no matter what you do.