The 21-year-old singer - who previously hit the headlines for his wild partying, arrests for motoring offences and egging a neighbour's house - was feeling "pretty lost" and though he isn't "super religious", his faith inspired him to take things in a different direction.
He said: "I am not going to go into detail of what I was doing and where I was at, but I was pretty lost and woke up one day and felt like God was telling me something.
"I'm not super religious or anything but I just heard a voice and was like, 'You know what? I'm going to change my life around. I'm going to switch up some things and put some stuff together'.
"I called my manager Scooter and said, 'We need to fix it.'"
The Sorry hitmaker - who is dating model Hailey Baldwin - still enjoys drinking and having a good time and doesn't think that is at odds with his religious beliefs.
Speaking on radio programme The Bert Show, he said: "We going and celebrating all the time, getting drinks. I am 21 now so I can go out with my friends and be responsible and still have a good time.
"What's weird is I am a Christian, I am a believer, and often people are too conservative and I don't think it's wrong.
"I'm stumbling over my words right now because I don't want to offend anybody, but I believe you can go and have a good time, get some drinks and enjoy yourself and can be with girls.
"I don't think you need to be serious about it.
"Loving God is a separate thing. But I don't think you have to love God and not be able to go out and enjoy yourself.
"As long as it's not provocative or intense or mean or evil. If you are living life based on loving God then just keep that in mind."