Q: Why do libertarians align themselves with the religious right, given the differences in the philosophy and ideas about the role of the state?
Let me reverse it for a moment: why do liberals align themselves with socialists and communists given the differences in the philosophy and ideas about the role of the state?
The quick answer for both questions is political pragmatism and political necessity.
Libertarians (or libertarian conservatives, classical liberals, etc) like Michelle and I are not exactly the majority. I'd say maybe a quarter of the GOP believes as we do, probably less. Independents probably have more libertarian conservatives percentage wise. For GOP libertarians like myself, compromising is the name of the game. To get what you want in the political game, you have to work with people you may not necessarily like. This isn't like our president, his problem is that he compromises with his ideology, not with people, and then shoves it through Congress.
Ron Paul's Audit the Fed bill is an example of this strategy. A common view between the far-left and libertarians, libertarian conservatives and some center-rights is that the Fed requires a lot of auditing and pruning. The left sees it as a capitalist tool of oppression, and that's their right to believe such nonsense. We, on the other hand, see the Fed as, at minimum, a overenthusiastic engineer playing god with the economy. At most, its an unconstitutional and immoral monopoly on currency that has brought on some of the worst economic collapses since the birth of the Republic. Guess who was the bill's co-sponsor? Leftist nut Representative Alan Grayson of Florida. This man has thrown out bombs like it was a G20 protest. He's even gone so far to barge in on local GOP meetings at restaurants, accusing them of following him and harassing him. He's crazy, but he's also a darling of the far-left and has some clout. Rep. Paul needed Rep. Grayson to get the bill moving, even if they hate totally opposite views on society and the state.
As for the religious right, don't be so quick to assume the religious right is an enemy of libertarianism. Not all libertarians are socially liberal, as much as being one is a popular notion of libertarianism. While video game bans, gay marriage bans and other socially conservative causes push the buttons of most libertarians, the religious right is also a champion of real religious freedom and not the anti-liberty associationism that we have now. Of course, one must watch out for the religious right's laxity on small government issues. More than once has it tossed out federalism or free markets for pork for churches.