You sound so much like me, it's scary. I "thought" I was in a good place with God, and then this happened. I realize now that my H hasn't been following God and has been "playing church". At first, H still gave it lip service. He was unable to feel God, read his bible, do anything. If you can get it, please read the book I recommended, Confident Woman. It'll help you realize who you are in Christ this very minute. Just remember, "All things work for the good of those who love God" Rom 8:28 That is the truth. And YES, ABSOLUTELY, God wants your marriage to succeed. He brought you together for a reason. Read James, Chapter 1 and see what it says about our trials. By going through this for my H, God is working on areas in my life that I need to be obedient in - patience, submission, faith. He is using what my H did (because God knew he would stray even before we were married), to make me a better Christian woman. I'll be able to hold my head up and say "Look what the Lord has done. Praise God" That is a promise from him. He NEVER changes, he's always the same.
I understand how you feel about God putting a distance between you and your H, but yet you feel like he wants the M to work. He truly does, but he also guards our hearts when we're hurting. He wants us to throw our cares upon him, and focus on what He wants us to do. Look at yourself. Here is an email that was sent to me by our Christian counselor when H was not at home. It changed me. I went to bible.org and looked up the articles for the verses he mentions below and prayed on them, studied them, and acted on them. I also listened to the audio he recommended and realized how hurtful I am with my words.
We believe it is best and biblical for the husband and wife to be counseled together ... in fact, we never counsel a couple separately. God's design for marriage is that the two are "one flesh" (Gen 2:24) and he commands us to speak (Eph 4:15,25-32) in a manner that is directed at solving problems. That simply cannot be accomplished when the two are separated. I understand that this may not be desirable emotionally, but God's commands assume His enablement (2 Pet 1:3; 2 Ti 3:16-17). Believers are to put off living by emotions and put on living by the principles/commands in God's all-sufficient Word (Eph 4:22-24) - that means obeying God whether we feel like it or not. This is also evidence of our salvation (cf 1 John, esp 1 Jn 4:20-5:2). This is God's best - so we cannot improve upon it. If you want to see more about what God's Word has to say about your particular situation, please go to http://www.gracechurchhuntsville.org/counselingresources.html and download the "Hope from God's Word" Bible study as well as listen to the audio lesson on the "4 Rules of Biblical Communication".
It's easy to get caught up in the sin of a spouse, but the good news is that you can be God's kind of person/wife/... regardless of how he behaves. Study 1 Pet 3:1-6 and see what instruction is given to wives whose husbands "do not obey the Word." Get busy with that - with your responsibilities (cf. Mt 7:2-5) and trust God for the rest (e.g., how your husband responds).
The primary goal in the life of all believers is it bring glory and honor to God (1 Cor 10:31; 2 Cor 5:9,10) - any other goal that is more important than that (i.e., you sin when you don't get it or you're willing to sin in order to get it) has become a sinful goal and repentance must occur. The Christian life is not free from problems - our priority is to produce Godly fruit in the midst of our problems (Ps 1).
God will bless your obedience!
Pray for your H. I know how it feels to see them not even trying. I'm still going through some of that with my H and it's hard to hope, but God is faithful. He HAS answered my prayers. I went from being a Christian that was satisfied, to being hungry, to having to pray and rest with Jesus. That's an amazing feeling. To HAVE to rely on God.. to HAVE to ask the Holy Spirit for help. I don't go through a day that's simple or easy anymore, but I also don't feel like I'm going through it alone anymore either. And, my H sees a change in me too. He has had to be brought down to his knees, but he now knows that he has to change, or as you said, we'll have to be out of fellowship with him.