This quote from Macbeth is from Act I, Scene 3. This is at the beginning of the famous scene in which Macbeth and Banquo ~ fresh from battle ~ run into the 3 witches and hear the prophesy that Macbeth will become King.
The 3 witches are basically saying hello to each other, before Macbeth arrives, and one of the witches recounts that a sailor's wife refused to give her a chestnut to chew. The witch plans to follow after the woman's husband (but in a sieve I'll thither sail) and do horrible things to him (and like a rat . . . . I'll do).
It was said that witches "could sail in an egg shell . . . through and under the tempestuous seas" (Reginal Scott, Discovery of Witches, 1584) and that witches had gone to sea "each one in a riddle or cive" as part of a plot to drown the king at sea (Newes from Scotland, around 1591).
"Like a rat without a tail" refers to the belief that witches could assume the form of any animal they wanted, but that they would not have a tail. The basis for this was that no part of a woman's body corresponds to the long tail of an animal. Presumably the choice of a rat was because rats were so common aboard ships.
See The Plays of William Shakespeare with Notes by Johnson and Steevens, Vol VII. For some reason I can't link to this, but there is a digitized version of the book that you can find through Google.