Meaning
Rigidly adhered to - without doubt or debate.
Origin
This is nautical term. A ship that was hard and fast was simply one that was firmly beached on land.
The term must have been well-known by the early 19th century as it was use in a figurative sense then; fir example. The [London] Times, Janusry 1820:
"She was laid before the fire, at about a yard distance, and was hard and fast asleep."
The Sailor's Word-Book, William Henry Smyth's 1867 nautical dictionary, defines the term:
"Hard and fast. Said of a ship on shore."