The sun first didn't set on the British Empire in the late 18th or early 19th century, when Britain had colonies in the Americas and added colonies in the West Pacific.
The sun has still not set on the British Empire in a literal sense. The direct descendant of the Empire are the British Overseas Territories, of which there are 14. Between midnight and 1 AM GMT, there is only one territory in which it is light--the only time when this is the case. This is the Pitcairn Islands in the Pacific--population a few dozen, best known for a scandal a few years ago in which most of the adult men on the island, including the mayor, were arrested for child abuse.
Randall Monroe of XKCD has done an astronomical analysis, and it appears that at no point in the next thousand years will it be dark in the entire Empire at the same time (there is no total solar eclipse in the next thousand years that will pass over the Pitcairns between 12 and 1 AM GMT).
So, literally valid.
Edit: After doing some (very quick) research, it seems likely that the sun first didn't set on the British Empire between 1769 (claiming of New Zealand by Captain Cook) and 1788 (beginning of the Botany Bay penal settlement), depending on how strong of a claim is required for a piece of land to become part of the Empire.
The statement that the sun never sets on an empire seems to have been attritbuted first to Karl V., who at that time was King of Spain and Emperor of the Holy Roman Empire. The meaning is that the empire is spread among so many time zones that at least in some of them, it is always day.
The phrase has been later applied to other empires as well, including the British Empire. As the Empire was spread from Canada via Europe and Africa to India, with many smaller colonies in between, it was certainly true in the sense mentioned above.
In a figurative sense "the British Empire" will exist forever, the phrase is untrue. The British Empire was gradually dissolved and has found a successor of sorts in the British Commonwealth. The legacy of the British Empire - language, legal and political system etc. - continues to be important in many parts of the world, though some former colonies have rejected the legacy on ground of it being colonialistic.