Madonna was inspired to write "Music" after attending a
After the critical and commercial success of her album
Ray of Light (1998), Madonna intended to embark on a new concert tour in 1999, but due to the delay of her film
The Next Best Thing, it was cancelled.
 By 2000, Madonna was dating director
Guy Ritchie, and was pregnant with their child. Wanting to distract herself from the media frenzy surrounding this news, Madonna concentrated on the development of her eighth studio album,
Music, instead of embarking on a tour.
 Buoyed up by the commercial success of her previous album, she was keen on getting back to the studio to record new music. Madonna was well disposed towards
William Orbit, producer of Ray of Light, but by 2000, his production and sound had become ubiquitous. Also, the music scene was being dominated by a younger generation of singers like
Britney Spears and
Christina Aguilera, prompting Madonna to look for a more distinctive sound.
 It was then that she was introduced to French DJ and producer
Mirwais Ahmadzaï through some common friends. Madonna instantly liked the pitch-shifting, pulverizing rhythms and
acid bass in his songs.
In an interview with
CNN, Madonna said, "
Guy Oseary, my partner at Maverick [Records], was given a demo by a French artist called Mirwais. [He] slipped it to me and said, 'What do you think [of him] as an artist to sign at Maverick?' [...] I just said 'Oh my God, this is what I want.' I just flipped over it and said, 'Please find out if he wants to work with me.'"
 Ahmadzaï always preferred taking musical risks and hence he wanted the collaborations with Madonna to get out the best from the artist. "The challenge was to make something current appear, something hidden in her personality. Everybody knows [Madonna] as a chameleon, as a businesswoman. I wanted to show her potential as a musician," Ahmadzaï noted.
 "Music" features production by Ahmadzaï, who Madonna has called a "genius".
Madonna said that the inspiration behind "Music" was a
Sting concert that she attended. There, the crowd was well-behaved until Sting began playing old hits by
The Police. "Everyone was practically holding hands... I mean, it really moved me," she told
Rolling Stone. "And I thought, 'That's what music does to people.'"