It makes sense in a number of ways
- Trend. All internet majors (Google, Amazon, Microsoft, Apple, Facebook) engage in hardware development. It's a new market, they are flush with cash and they know precisely what their users do.
- Cross-selling. With the exception of Apple, selling hardware is aimed at growing sales in an adjacent area.
- Vertical intergration. As such, it is a form of vertical integration, capturing a larger part of the value chain.
- Diversification. Facebook's revenues are 98.0% from ads (2.0% from payments & other fees). Diversification, in light of the inevitable growth slow-down, is coming none too soon. In fact, the other majors are way ahead of Facebook in this respect.