The song features a music hall-inspired piano line that recurs throughout the piece, as well as a brass section. The song modulates smoothly through several keys.
The song key is E-flat major, showing up embellished chords with jazzy sprinkled dissonances. The verse is a syncopated replicate of the first melodic section adding two extra beats, a technique similar to that used later by McCartney in “Two of Us”. Though the bridge is in the key of F major, the manner in which it abruptly sets in and exits makes it sound more out-of-the-way than it really is.
The title "Martha My Dear" was inspired by McCartney's Old English Sheepdog, also named Martha. McCartney has said that the song itself is probably about his longtime love interest Jane Asher. Asher broke off their engagement in mid-1968. McCartney chides her with the lyrics in the song "...when you find yourself in the thick of it, help yourself to a bit of what is all around you..." Asher inspired many of McCartney's songs, including "Here, There and Everywhere", "I'm Looking Through You", "For No One" and "We Can Work It Out". (A later "Martha" lyric explains, "You have always been my inspiration..." McCartney has also said, cryptically, that the song is about his "muse"—the voice in his head that tells him what words and music to write.)