Origin of "rank hath its privileges"
The oldest instance that I could find in a series of Google Books searches for the expression is from Harriet Lee, The Mysterious Marriage; Or, The Heirship of Roselva: A Play (1798):
Lord Albert. (striking him.) Lying fool, begone!
Rodolphus. Nay, no liar, I swear—nor so much of a fool as not to know that if rank has its privileges, age and fidelity are not without theirs. I humbly wish your Lordship a good night. And when you have a follower more faithful than myself, may heaven and you reward him as he serves!
But it also appears in A Lady, Life and Death of a Monkey; or the Village of Alton: A Tale for Young Persons (1814):
Some persons affect to rail at rank and title. Let such consider, if they can, the beauty, the harmony, the convenience, the happiness, that result from the different ranks in society—and the dependence which each has on the other. In this happy island each rank has its privileges, and all ranks are free.
Almost as old as the first of these instances is an instance arguing (more directly than Rodolphus did) that age has its privileges. From Thomas Gisborne, An Enquiry Into the Duties of the Female Sex (1806):
The spring and summer of life are past; autumn is far advanced; the frown of winter is already felt. Age has its privileges and its honours. It claims exemption from the more arduous offices of society, to which its strength is no longer equal; and immunity from some at least of the exertions, the fruit of which it cannot enjoy. Deprived of many active pleasures, it claims an equivalent of ease and repose.
And, of course, youth put in an early claim as well. From "Revolt at Princeton College," in The Weekly Inspector (May 9, 1807):
"For your individual self, sir, as you feel within a spirit of freedom and independence, capable to revolt from tyranny and resist oppression, we expect you tio adhere to your deliberate resolve, to evince to the world that you are capable of acting for yourself, and that AGE should not sanction IMPERTINENCE, that youth has its privileges, and that the GENIUS of REVOLT shall come forward to support them, whenever the hand of presuming authority shall attempt to level or abridge them."
In approximately the same time period, Edmund Burke, while not acknowledging its claim to privileges, concedes that wealth has its "natural weight." From Burke, "Thoughts on French Affairs" (1791), in The Works of the Right Honourable Edmund Burke, Collected in Three Volumes (1802):
As to the monied men—whilst the Monarchy continued, there is no doubt, that merely as such, they did not enjoy the privileges of nobility, but nobility was of so easy an acquisition, that it was the fault or neglect of all of that description, who did not obtain its privileges, for their lives at least, in virtue of office. ...
What institutions and manners together had done in France, Manners alone do here. It is the natural operation of things where there exists a Crown, a Court, splendid Orders of Knighthood, and an Hereditary Nobility; where there exists a fixed, permanent, landed Gentry, continued in greatness and opulence by the law of primogeniture, and by a protection given to family settlements;—where there exists a standing Army and Navy;—where there exists a Church Establishment, which bestows on learning and parts an interest combined with that of Religion and the State; in a country where such things exist, wealth, new in it's acquisition, and precarious in it's duration, can never rank first, or even near the first ; though wealth has it's natural weight, further, than as it is balanced and even preponderated amongst us as amongst other nations, by artificial institutions and opinions growing out of them.
One possible source of these attributions of privileges to various special class is a 1696 translation of La Bruyère's Characters. From Jean de La Bruyère, Supplement to the Characters, or Manners of the Present Age, sixth edition (1696/1713):
O Times! O Manners! cries HERACLITUS; O miserable Age, fill'd with bad Examples! O wretched, wretched World, where Virtue is persecuted, wjere Wickedness domineers, where it triumphs! ... Who can, with dry Eyes and an undisturb'dd Soul, behold such lamentable Things? There is no Office, no Post but has its Privileges; there is no Incumbent, no Occupant, but is at liberty to talk, plead, sollicite to defend his Rights: The Royal Dignity alone enjoys no longer its Privileges; Kings themselves have renounc'd them.
Conclusions
The earliest exact match I could find in Google Books search results for "rank has its privileges is from a 1798 play by Harriet Lee. However, quite similar assertions were made at approximately the same time about age, youth, and wealth, too.
La Bruyère may have influenced the expression with his observation in 1696 that there is no office and no post but has its privileges—however, it is difficult to assert this connection with any degree of certainty.
Looking through Google Books results, I haven't found anything so far that indicates that "rank has/hath its privileges" is a sentence of very great antiquity.
There is a similar sentence in Hood's Magazine, Vol. IX (January to June, 1848):
"Property," it is said, "has its duties as well as its rights;" to this may be added, "Rank has its duties as well as its privileges."
(p. 7; "The Times; or, Modern Philosophy")
It seems likely to me that the "snowclone" "X has/hath its privileges" is older than the specific saying "Rank has/hath its privileges". I'm not sure, though.
Here's an example of "hath its privileges" from 1827:
grief, like impatience, hath its privileges
(Tales of the Crusaders, Tale II. "The Talisman." Tales and Romances of the Author of Waverley, Volume VI, p. 233.)